MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / _transform_params

Method _transform_params

cassandra/cluster.py:2924–2941  ·  view source on GitHub ↗
(self, parameters, graph_options)

Source from the content-addressed store, hash-verified

2922 execution_profile.row_factory = row_factory
2923
2924 def _transform_params(self, parameters, graph_options):
2925 if not isinstance(parameters, dict):
2926 raise ValueError('The parameters must be a dictionary. Unnamed parameters are not allowed.')
2927
2928 # Serialize python types to graphson
2929 serializer = GraphSON1Serializer
2930 if graph_options.graph_protocol == GraphProtocol.GRAPHSON_2_0:
2931 serializer = GraphSON2Serializer()
2932 elif graph_options.graph_protocol == GraphProtocol.GRAPHSON_3_0:
2933 # only required for core graphs
2934 context = {
2935 'cluster': self.cluster,
2936 'graph_name': graph_options.graph_name.decode('utf-8') if graph_options.graph_name else None
2937 }
2938 serializer = GraphSON3Serializer(context)
2939
2940 serialized_parameters = serializer.serialize(parameters)
2941 return [json.dumps(serialized_parameters).encode('utf-8')]
2942
2943 def _target_analytics_master(self, future):
2944 future._start_timer()

Callers 1

execute_graph_asyncMethod · 0.95

Calls 5

GraphSON2SerializerClass · 0.90
GraphSON3SerializerClass · 0.90
decodeMethod · 0.80
serializeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected