def to_join_key(obj):
 if (obj is None):
  return JoinKey(None, None, None)
 if isinstance(obj, compat.string_type):
  obj = obj.split('.')
 if isinstance(obj, (tuple, list)):
  if (len(obj) == 1):
   column = obj[0]
   table = None
   schema = None
  elif (len(obj) == 2):
   (table, column) = obj
   schema = None
  elif (len(obj) == 3):
   (schema, table, column) = obj
  else:
   raise ArgumentError('Join key can have 1 to 3 items has {}: {}'.format(len(obj), obj))
 elif hasattr(obj, 'get'):
  schema = obj.get('schema')
  table = obj.get('table')
  column = obj.get('column')
 else:
  schema = obj.schema
  table = obj.table
  column = obj.column
 if isinstance(column, list):
  column = tuple(column)
 return JoinKey(schema, table, column)

def to_join_key ( obj ) : if ( obj is None ) : return JoinKey ( None , None , None ) if isinstance ( obj , compat . string_type ) : obj = obj . split ( '.' ) if isinstance ( obj , ( tuple , list ) ) : if ( len ( obj ) == 1 ) : column = obj [ 0 ] table = None schema = None elif ( len ( obj ) == 2 ) : ( table , column ) = obj schema = None elif ( len ( obj ) == 3 ) : ( schema , table , column ) = obj else : raise ArgumentError ( 'Join key can have 1 to 3 items has {}: {}' . format ( len ( obj ) , obj ) ) elif hasattr ( obj , 'get' ) : schema = obj . get ( 'schema' ) table = obj . get ( 'table' ) column = obj . get ( 'column' ) else : schema = obj . schema table = obj . table column = obj . column if isinstance ( column , list ) : column = tuple ( column ) return JoinKey ( schema , table , column )
utility function that will create joinkey tuple from an anonymous tuple .