#NEWLINE# @ classmethod #NEWLINE# def from_message( cls , query_id , column_metadata , pk_indexes , cluster_metadata , query , prepared_keyspace , protocol_version ) : #NEWLINE# #INDENT# if ( not column_metadata ) : #NEWLINE# #INDENT# return PreparedStatement ( column_metadata , query_id , None , query , prepared_keyspace , protocol_version ) #NEWLINE# #UNINDENT# if pk_indexes : #NEWLINE# #INDENT# routing_key_indexes = pk_indexes #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# routing_key_indexes = None #NEWLINE# first_col = column_metadata [ 0 ] #NEWLINE# ks_meta = cluster_metadata . keyspaces . get ( first_col . keyspace_name ) #NEWLINE# if ks_meta : #NEWLINE# #INDENT# table_meta = ks_meta . tables . get ( first_col . table_name ) #NEWLINE# if table_meta : #NEWLINE# #INDENT# partition_key_columns = table_meta . partition_key #NEWLINE# statement_indexes = dict ( ( ( c . name , i ) for ( i , c ) in enumerate ( column_metadata ) ) ) #NEWLINE# try : #NEWLINE# #INDENT# routing_key_indexes = [ statement_indexes [ c . name ] for c in partition_key_columns ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return PreparedStatement ( column_metadata , query_id , routing_key_indexes , query , prepared_keyspace , protocol_version )