Itxaka
Itxaka

Reputation: 785

Can I create a SQLALCHEMY model from the pure sql CREATE?

I am checking SQLAlchemy and it's models and I was wondering if having the raw CREATE sql from a database, I can create the models automatically or do I have to create them by hand class per class?

So instead of writing every table in a class with every field and it's attributes, just extract the SQL CREATE statement and pass it to any function that outputs a model, or even use the SQL directly with no need to create a model.

Upvotes: 2

Views: 226

Answers (1)

Marco Mariani
Marco Mariani

Reputation: 13766

Yes, you can create model objects from an existing schema written with SQL. See the reflection feature.

Upvotes: 4

Related Questions