We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrated issue, originally created by Anonymous
--- lib/sqlalchemy/dialects/oracle/base.py 2010-08-03 07:18:07.000000000 -0400 +++ /home/rarch/site-packages/SQLAlchemy-0.6.1.4-py2.6-linux-x86_64.egg/sqlalchemy/dialects/oracle/base.py 2010-08-03 11:39:54.000000000 -0400 @@ -929,43 +929,58 @@ @reflection.cache def get_primary_keys(self, connection, table_name, schema=None, **kw): """ kw arguments can be: oracle_resolve_synonyms dblink """ + return self._get_primary_keys(connection, table_name, schema=None, **kw)[0](0) + @reflection.cache + def _get_primary_keys(self, connection, table_name, schema=None, **kw): resolve_synonyms = kw.get('oracle_resolve_synonyms', False) dblink = kw.get('dblink', '') info_cache = kw.get('info_cache') (table_name, schema, dblink, synonym) = \ self._prepare_reflection_args(connection, table_name, schema, resolve_synonyms, dblink, info_cache=info_cache) pkeys = [ constraint_name = None constraint_data = self._get_constraint_data(connection, table_name, schema, dblink, info_cache=kw.get('info_cache')) for row in constraint_data: #print "ROW:" , row (cons_name, cons_type, local_column, remote_table, remote_column, remote_owner) = \ row[0:2](] +) + tuple([for x in row[2:6](self.normalize_name(x))]) if cons_type == 'P': + if constraint_name is None: + constraint_name = self.normalize_name(cons_name) pkeys.append(local_column) - return pkeys + return pkeys, constraint_name + + @reflection.cache + def get_pk_constraint(self, connection, table_name, schema=None, **kw): + cols, name = self._get_primary_keys(connection, table_name, schema=schema, **kw) + + return { + 'constrained_columns':cols, + 'name':name + } @reflection.cache def get_foreign_keys(self, connection, table_name, schema=None, **kw): """ kw arguments can be: oracle_resolve_synonyms dblink
You may consider removing @reflection.cache from get_primary_keys() (and get_pk_constraint()) and keep it only on _get_primary_keys()
@reflection.cache
get_primary_keys()
get_pk_constraint()
_get_primary_keys()
The attached file's output before patch
type: PrimaryKeyConstraint() name: None columns: [u'id_b'](u'id_a',) (u'SYS_C0048811', u'P', u'ID_A', None, None, None, Decimal('1'), None) (u'SYS_C0048811', u'P', u'ID_B', None, None, None, Decimal('2'), None)
after patch
type: PrimaryKeyConstraint() name: sys_c0048811 columns: [u'id_b'](u'id_a',) (u'SYS_C0048811', u'P', u'ID_A', None, None, None, Decimal('1'), None) (u'SYS_C0048811', u'P', u'ID_B', None, None, None, Decimal('2'), None)
Thanks,
Kent
Attachments: oraclereflect.py
The text was updated successfully, but these errors were encountered:
Anonymous wrote:
OracleReflectionPrimaryKeyConstraintName
Sorry, something went wrong.
Changes by Anonymous:
Michael Bayer (@zzzeek) wrote:
these 0.6.4 milestones are tentative
Changes by Michael Bayer (@zzzeek):
Cumulative patch presented in #1867
perfect ! 36fa246.
No branches or pull requests
Migrated issue, originally created by Anonymous
My patch:
Note
You may consider removing
@reflection.cache
fromget_primary_keys()
(andget_pk_constraint()
) and keep it only on_get_primary_keys()
The attached file's output
before patch
after patch
Thanks,
Kent
Attachments: oraclereflect.py
The text was updated successfully, but these errors were encountered: