How to Prevent SQLAlchemy Core from Quoting Name

11 views
Skip to first unread message

mkmo...@gmail.com

unread,
Jun 17, 2022, 2:13:44 PM6/17/22
to sqlalchemy
Using a `.` in a table name will cause the table name to be quoted.

For example:

    from sqlalchemy import table, column
    t = table('myschema.mytable', column('id'))
    print(select(t.c.id))

Outputs:

    SELECT "myschema.mytable".id
    FROM "myschema.mytable"

This fails in Oracle because the table name within the quotes is not in all caps.

How can I remove the quotes and instead have it render:

    SELECT myschema.mytable.id
    FROM myschema.mytable

Thanks and best regards,

Matthew

mkmo...@gmail.com

unread,
Jun 17, 2022, 2:18:05 PM6/17/22
to sqlalchemy
My apologies, I just saw that I can use the schema key word for this case:

    t = table('mytable', column('id'), schema='myschema')

Best regards,

Matthew
Reply all
Reply to author
Forward
0 new messages