From 82d194c9a65b09fef8d52318cbe38e2c84dfd2ca Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 15 Apr 2010 19:05:41 -0400 Subject: - Added get_pk_constraint() to reflection.Inspector, similar to get_primary_keys() except returns a dict that includes the name of the constraint, for supported backends (PG so far). [ticket:1769] - Postgresql reflects the name of primary key constraints, if one exists. [ticket:1769] --- lib/sqlalchemy/engine/base.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/sqlalchemy/engine/base.py') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 4c5a6a82b..d35796063 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -260,8 +260,23 @@ class Dialect(object): Given a :class:`~sqlalchemy.engine.Connection`, a string `table_name`, and an optional string `schema`, return primary key information as a list of column names. + """ + raise NotImplementedError() + + def get_pk_constraint(self, table_name, schema=None, **kw): + """Return information about the primary key constraint on `table_name`. + Given a string `table_name`, and an optional string `schema`, return + primary key information as a dictionary with these keys: + + constrained_columns + a list of column names that make up the primary key + + name + optional name of the primary key constraint. + + """ raise NotImplementedError() def get_foreign_keys(self, connection, table_name, schema=None, **kw): -- cgit v1.2.1