zzzeek/sqlalchemy — pull request #34 by ijl (2013-10-11 19:26:00+00:00)
Title: PostgreSQL foreign key inspection includes options

I've modified `PGDialect.get_foreign_keys()` to include the foreign key's options such as `ON UPDATE`, `DEFERRABLE`, &c. This is implemented by just expanding the regex parsing of PG's `pg_get_constraintdef()` output. I've put the options under an 'options' key in order to match the only other dialect which exposes options, MySQL.

There's just one thing ambiguous thing about this, which is how to return default values. Postgres doesn't include default values (e.g., `MATCH SIMPLE`) in its `pg_getconstraintdef` output. We could set default values in the inspector to reflect the *implemented* value, or return `None` and let the client figure it out. The current behavior I see elsewhere is the latter, so I matched that; but there's something to be said for the implemented value, for, e.g., using inspector to reconstruct the exact schema on another backend. Let me know if you want to impute the defaults.