#NEWLINE# @ reflection . cache #NEWLINE# @ _db_plus_owner #NEWLINE# def get_pk_constraint( self , connection , tablename , dbname , owner , schema , **kw ) : #NEWLINE# #INDENT# pkeys = [ ] #NEWLINE# TC = ischema . constraints #NEWLINE# C = ischema . key_constraints . alias ( 'C' ) #NEWLINE# s = sql . select ( [ C . c . column_name , TC . c . constraint_type , C . c . constraint_name ] , sql . and_ ( ( TC . c . constraint_name == C . c . constraint_name ) , ( TC . c . table_schema == C . c . table_schema ) , ( C . c . table_name == tablename ) , ( C . c . table_schema == C ) ) ) #NEWLINE# c = connection . execute ( s ) #NEWLINE# constraint_name = None #NEWLINE# for row in c : #NEWLINE# #INDENT# if ( 'PRIMARY' in row [ TC . c . constraint_type . name ] ) : #NEWLINE# #INDENT# pkeys . append ( row [ 0 ] ) #NEWLINE# if ( constraint_name is None ) : #NEWLINE# #INDENT# constraint_name = row [ C . c . constraint_name . name ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return { #NEWLINE# #INDENT# 'constrained_columns' : pkeys , #NEWLINE# 'name' : constraint_name , #NEWLINE# #UNINDENT# }