55```
66"""
77
8- import json
9-
108import clickhouse_driver
119from clickhouse_driver import Client , connect
1210
1816if clickhouse_driver .VERSION < (0 , 2 , 6 ):
1917 EXPECT_PARAMS_IN_SELECT = False
2018
21- PARAMS_SERIALIZER = json .dumps
22-
2319
2420def test_clickhouse_client_breadcrumbs (sentry_init , capture_events ) -> None :
2521 sentry_init (
@@ -146,7 +142,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) ->
146142 "db.user" : "default" ,
147143 "server.address" : "localhost" ,
148144 "server.port" : 9000 ,
149- "db.result" : str ([]) ,
145+ "db.result" : [] ,
150146 },
151147 "message" : "DROP TABLE IF EXISTS test" ,
152148 "type" : "default" ,
@@ -159,7 +155,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) ->
159155 "db.user" : "default" ,
160156 "server.address" : "localhost" ,
161157 "server.port" : 9000 ,
162- "db.result" : str ([]) ,
158+ "db.result" : [] ,
163159 },
164160 "message" : "CREATE TABLE test (x Int32) ENGINE = Memory" ,
165161 "type" : "default" ,
@@ -172,7 +168,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) ->
172168 "db.user" : "default" ,
173169 "server.address" : "localhost" ,
174170 "server.port" : 9000 ,
175- "db.params" : PARAMS_SERIALIZER ( [{"x" : 100 }]) ,
171+ "db.params" : ' [{"x": 100}]' ,
176172 },
177173 "message" : "INSERT INTO test (x) VALUES" ,
178174 "type" : "default" ,
@@ -185,7 +181,7 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) ->
185181 "db.user" : "default" ,
186182 "server.address" : "localhost" ,
187183 "server.port" : 9000 ,
188- "db.params" : PARAMS_SERIALIZER ( [[170 ], [200 ]]) ,
184+ "db.params" : " [[170], [200]]" ,
189185 },
190186 "message" : "INSERT INTO test (x) VALUES" ,
191187 "type" : "default" ,
@@ -198,8 +194,8 @@ def test_clickhouse_client_breadcrumbs_with_pii(sentry_init, capture_events) ->
198194 "db.user" : "default" ,
199195 "server.address" : "localhost" ,
200196 "server.port" : 9000 ,
201- "db.result" : str ( [[370 ]]) ,
202- "db.params" : PARAMS_SERIALIZER ( {"minv" : 150 }) ,
197+ "db.result" : " [[370]]" ,
198+ "db.params" : ' {"minv": 150}' ,
203199 },
204200 "message" : "SELECT sum(x) FROM test WHERE x > 150" ,
205201 "type" : "default" ,
@@ -398,7 +394,7 @@ def test_clickhouse_client_spans_with_pii(
398394 "server.address" : "localhost" ,
399395 "server.port" : 9000 ,
400396 "db.query.text" : "DROP TABLE IF EXISTS test" ,
401- "db.result" : str ([]) ,
397+ "db.result" : [] ,
402398 },
403399 "trace_id" : transaction_trace_id ,
404400 "parent_span_id" : transaction_span_id ,
@@ -415,7 +411,7 @@ def test_clickhouse_client_spans_with_pii(
415411 "db.name" : "" ,
416412 "db.user" : "default" ,
417413 "db.query.text" : "CREATE TABLE test (x Int32) ENGINE = Memory" ,
418- "db.result" : str ([]) ,
414+ "db.result" : [] ,
419415 "server.address" : "localhost" ,
420416 "server.port" : 9000 ,
421417 },
@@ -434,7 +430,7 @@ def test_clickhouse_client_spans_with_pii(
434430 "db.name" : "" ,
435431 "db.user" : "default" ,
436432 "db.query.text" : "INSERT INTO test (x) VALUES" ,
437- "db.params" : PARAMS_SERIALIZER ( [{"x" : 100 }]) ,
433+ "db.params" : ' [{"x": 100}]' ,
438434 "server.address" : "localhost" ,
439435 "server.port" : 9000 ,
440436 },
@@ -470,9 +466,9 @@ def test_clickhouse_client_spans_with_pii(
470466 "db.system" : "clickhouse" ,
471467 "db.name" : "" ,
472468 "db.user" : "default" ,
473- "db.params" : PARAMS_SERIALIZER ( {"minv" : 150 }) ,
469+ "db.params" : ' {"minv": 150}' ,
474470 "db.query.text" : "SELECT sum(x) FROM test WHERE x > 150" ,
475- "db.result" : str ([( 370 ,)]) ,
471+ "db.result" : "[[ 370]]" ,
476472 "server.address" : "localhost" ,
477473 "server.port" : 9000 ,
478474 },
@@ -624,7 +620,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N
624620 "db.user" : "default" ,
625621 "server.address" : "localhost" ,
626622 "server.port" : 9000 ,
627- "db.result" : str ( [[], []]) ,
623+ "db.result" : " [[], []]" ,
628624 },
629625 "message" : "DROP TABLE IF EXISTS test" ,
630626 "type" : "default" ,
@@ -637,7 +633,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N
637633 "db.user" : "default" ,
638634 "server.address" : "localhost" ,
639635 "server.port" : 9000 ,
640- "db.result" : str ( [[], []]) ,
636+ "db.result" : " [[], []]" ,
641637 },
642638 "message" : "CREATE TABLE test (x Int32) ENGINE = Memory" ,
643639 "type" : "default" ,
@@ -650,7 +646,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N
650646 "db.user" : "default" ,
651647 "server.address" : "localhost" ,
652648 "server.port" : 9000 ,
653- "db.params" : PARAMS_SERIALIZER ( [{"x" : 100 }]) ,
649+ "db.params" : ' [{"x": 100}]' ,
654650 },
655651 "message" : "INSERT INTO test (x) VALUES" ,
656652 "type" : "default" ,
@@ -663,7 +659,7 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N
663659 "db.user" : "default" ,
664660 "server.address" : "localhost" ,
665661 "server.port" : 9000 ,
666- "db.params" : PARAMS_SERIALIZER ( [[170 ], [200 ]]) ,
662+ "db.params" : " [[170], [200]]" ,
667663 },
668664 "message" : "INSERT INTO test (x) VALUES" ,
669665 "type" : "default" ,
@@ -676,8 +672,8 @@ def test_clickhouse_dbapi_breadcrumbs_with_pii(sentry_init, capture_events) -> N
676672 "db.user" : "default" ,
677673 "server.address" : "localhost" ,
678674 "server.port" : 9000 ,
679- "db.params" : PARAMS_SERIALIZER ( {"minv" : 150 }) ,
680- "db.result" : str ( [[["370" ]], [["'sum(x)'" , "'Int64'" ]]]) ,
675+ "db.params" : ' {"minv": 150}' ,
676+ "db.result" : ' [[["370"]], [["\ ' sum(x)\ ' ", "\ ' Int64\ ' "]]]' ,
681677 },
682678 "message" : "SELECT sum(x) FROM test WHERE x > 150" ,
683679 "type" : "default" ,
@@ -871,7 +867,7 @@ def test_clickhouse_dbapi_spans_with_pii(
871867 "db.name" : "" ,
872868 "db.user" : "default" ,
873869 "db.query.text" : "DROP TABLE IF EXISTS test" ,
874- "db.result" : str (([ ], [])) ,
870+ "db.result" : "[[ ], []]" ,
875871 "server.address" : "localhost" ,
876872 "server.port" : 9000 ,
877873 },
@@ -890,7 +886,7 @@ def test_clickhouse_dbapi_spans_with_pii(
890886 "db.name" : "" ,
891887 "db.user" : "default" ,
892888 "db.query.text" : "CREATE TABLE test (x Int32) ENGINE = Memory" ,
893- "db.result" : str (([ ], [])) ,
889+ "db.result" : "[[ ], []]" ,
894890 "server.address" : "localhost" ,
895891 "server.port" : 9000 ,
896892 },
@@ -909,7 +905,7 @@ def test_clickhouse_dbapi_spans_with_pii(
909905 "db.name" : "" ,
910906 "db.user" : "default" ,
911907 "db.query.text" : "INSERT INTO test (x) VALUES" ,
912- "db.params" : PARAMS_SERIALIZER ( [{"x" : 100 }]) ,
908+ "db.params" : ' [{"x": 100}]' ,
913909 "server.address" : "localhost" ,
914910 "server.port" : 9000 ,
915911 },
@@ -928,7 +924,7 @@ def test_clickhouse_dbapi_spans_with_pii(
928924 "db.name" : "" ,
929925 "db.user" : "default" ,
930926 "db.query.text" : "INSERT INTO test (x) VALUES" ,
931- "db.params" : PARAMS_SERIALIZER ( [[170 ], [200 ]]) ,
927+ "db.params" : " [[170], [200]]" ,
932928 "server.address" : "localhost" ,
933929 "server.port" : 9000 ,
934930 },
@@ -947,8 +943,8 @@ def test_clickhouse_dbapi_spans_with_pii(
947943 "db.name" : "" ,
948944 "db.user" : "default" ,
949945 "db.query.text" : "SELECT sum(x) FROM test WHERE x > 150" ,
950- "db.params" : PARAMS_SERIALIZER ( {"minv" : 150 }) ,
951- "db.result" : str (([( 370 ,)] , [( "sum(x)" , "Int64" )])) ,
946+ "db.params" : ' {"minv": 150}' ,
947+ "db.result" : '[[[ 370]] , [[ "sum(x)", "Int64"]]]' ,
952948 "server.address" : "localhost" ,
953949 "server.port" : 9000 ,
954950 },
0 commit comments