On 9/30/15 3:09 PM, Steve Murphy wrote:
See below
On Tuesday, September 8, 2015 at 9:00:12 PM UTC-4, Michael Bayer wrote:
you can get these like this:
from sqlalchemy import inspect
insp = inspect(my_engine)
fk_constraints = insp.get_foreign_keys('mytable')
uq_constraints = insp.get_unique_constraints('mytable')
indexes = insp.get_indexes('mytable')
docs:
http://docs.sqlalchemy.org/en/rel_1_0/core/reflection.html#fine-grained-reflection-with-inspector
<http://docs.sqlalchemy.org/en/rel_1_0/core/reflection.html#fine-grained-reflection-with-inspector>
I tried the above, and I could get the foreign keys, but the
insp.get_unique_constraints('mytable')
returns an empty list.
I tried it against a postgresql table (that has unique constraints),
version 8.4.20...
I don't have many other versions available at the moment. I don't know
if that makes
any difference, anyway.
And, I'm running 1.0.8 sqlalchemy.
Is this a bug, or are there some requirements to get the unique
constraints?
there's no known bugs in fetching unique constraints. PG 8.4 is a
pretty old version but should be working.
note that a unique index and a unique constraint aren't listed as the
same thing, however. you might just have unique indexes.
many thanks
murf
--
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 sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.