How I can get raw sql for this table?
class Test(db.Model):
__tablename__ = 'test'
id = db.Column(db.Integer, primary_key=True)
birthday = db.Column(db.Date)
gender = db.Column(db.Enum('male', 'female', name='TYPE_GENDER'))
relationship_status = db.Column(db.Enum('free', 'in_relationship',
'married', 'complicated', 'in_open_relationship', 'widowed',
name='TYPE_RELATION'))
relationship_user_id = db.Column(db.Integer,
db.ForeignKey('test.id'))
relationship_user = db.relationship('Test',
backref=db.backref('parent', remote_side=id))
religion_id = db.Column(db.Integer, db.ForeignKey('religion.id'))
religion = db.relationship('Religion', backref=db.backref('user'),
cascade='all, delete, delete-orphan')
I need get something like that:
CREATE TYPE "TYPE_GENDER" AS ENUM ('male','female')
CREATE TYPE "TYPE_RELATION" AS ENUM
('free','in_relationship','married','complicated','in_open_relationship','widowed')
CREATE TABLE test (
id SERIAL NOT NULL,
birthday DATE,
gender "TYPE_GENDER",
relationship_status "TYPE_RELATION",
relationship_user_id INTEGER,
religion_id INTEGER,
PRIMARY KEY (id),
FOREIGN KEY(relationship_user_id) REFERENCES test (id),
FOREIGN KEY(religion_id) REFERENCES religion (id)
)
CREATE INDEX ix_test_relationship_user_id ON test
(relationship_user_id)
Thanks.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.