This is the casing convention of the database and SQLAlchemy does not consider 
the name to be in "uppercase" or "lowercase" (or even "mixed case") but rather 
"case insensitive", which really means the name is referred towards without any 
quoting.    When no quoting is applied, there is essentially no "casing" at all 
to the identifier that is stored by the database.

When you refer to the table name in SQLAlchemy, such as in a Table() object, or 
in Alembic as in op.create_table(), refer to it as all lower case at all times 
in the Python code- this indicates to SQLAlchemy that this is a case 
insensitive name and should not be quoted (as long as it has no special 
characters, spaces, etc).  SQLAlchemy will automatically render the name 
without quotes in DDL, DML and DQL, and render it as UPPERCASE when it queries 
DB2's catalogs, and as lower case when it queries PostgreSQL's catalogs.


On Mon, Jan 4, 2021, at 4:12 PM, Ke Zhu - k...@us.ibm.com wrote:
> The use case is migrating data from a Db2 instance (where schema is not
> managed under Alembic migration) to a postgresql instance (where I plan
> to manage schema via Alembic).
> 
> In Db2, by default, it stores unquoted mixed case identifiers in
> Uppercase. While the postgres I got it stores unquoted mixed case
> indetifiers in lowercase. So If I plan to keep such convention in
> postgres (store unquoted mixed case identifiers like table name in
> lowercase), what's the suggested practice to migrate an existing table
> like "XXX_YYY_ZZZ" to "xxx_yyy_zzz"?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy-alembic" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy-alembic+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy-alembic/5d4bf2d1f07e6958f94ee08d941db96c96fd91f0.camel%40us.ibm.com.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy-alembic+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy-alembic/99214f97-7066-4204-a3c4-bf0438621ec8%40www.fastmail.com.

Reply via email to