"cube" would need to be added as a reserved word.

for now, use quote=True:

Column("cube", String(40), quote=True)

https://docs.sqlalchemy.org/en/latest/core/metadata.html?highlight=column%20quote#sqlalchemy.schema.Column.params.quote


On Sat, Feb 16, 2019 at 4:06 PM <[email protected]> wrote:
>
> SQLAlchemy : 1.2.17, MySql: 8.0.13
>
> My python script to define the column to be created is as below:
>
> sa.Column(sa.MEDIUMTEXT())
>
>
> The SQL script being generated by SQLAlchemy is as below:
>
> CREATE TABLE sys_report_olap ( choice MEDIUMTEXT, choice_ MEDIUMTEXT, 
> column_dimensions MEDIUMTEXT, column_dimensions_ MEDIUMTEXT, cube 
> VARCHAR(40), # Fails here since cube is a keyword in MySql and its not 
> quoted. cube_ VARCHAR(40), PRIMARY KEY (sys_id, sys_id_) )
>
>
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> ---
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to