muckabout
muckabout

Reputation: 1941

How to get SqlAlchemy Table to read "implicit" schema

Using table creation as normal:

t = Table(name, meta, [columns ...])

This is the first run where I create the table. In future executions I would like to use the table without having to indicate the [columns]. This seems redundant as it should already be specified in the table schema. In other words, for future accesses, I'd like to simply do:

t = Table(name, meta)  # columns already read from schema

Is there a way to do this in SqlAlchemy?

Upvotes: 0

Views: 707

Answers (1)

van
van

Reputation: 76972

See Reflecting Database Objects of SA documentation:

t = Table(name, meta, autoload=True)#, autoload_with=engine)

Upvotes: 1

Related Questions