Hi!
i test sqlalchemy 1.1.12 - 1.2.5
create table check constraint.
-----------------------------------
class testTable(db):
    __tablename__ = 'testTable'

    id = Column(INT, primary_key = True, autoincrement = True, unique = 
True)
    ser = Column(INT)

    CheckConstraint('ser>100')

#sqlalchemy echo and pgadmin4 

CREATE TABLE "testTable" (
    id SERIAL NOT NULL, 
    ser INTEGER, 
    PRIMARY KEY (id), 
    UNIQUE (id)

no check constraint.
------------------------------
class testTable(db):
    __tablename__ = 'testTable'

    id = Column(INT, primary_key = True, autoincrement = True, unique = 
True)
    ser = Column(INT)
    __table_args__ = (
        CheckConstraint('ser>100'),
        )
    

#sqlalchemy echo
CREATE TABLE "testTable" (
    id SERIAL NOT NULL, 
    ser INTEGER, 
    PRIMARY KEY (id), 
    CHECK (ser>100), 
    UNIQUE (id)

this OK!

so, i must use __table_args__ define CheckConstraint ??





-- 
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