Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
epinzur committed Oct 3, 2024
1 parent 582d1f5 commit b02358d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/cassio/table/mixins/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ def _extract_where_clause_blocks(
these_wc_vals_list: List[Any] = []
# WHERE creation:
for k, v in sorted(split_metadata.get("metadata_s", {}).items()):
these_wc_blocks.append(f"metadata_s[%s] = %s")
these_wc_vals_list.append(k)
these_wc_vals_list.append(v)
these_wc_blocks.append("metadata_s[%s] = %s")
these_wc_vals_list.extend([k, v])
# no new kwargs keys are created, all goes to WHERE
this_args_dict: Dict[str, Any] = {}
these_wc_vals = tuple(these_wc_vals_list)
Expand Down
24 changes: 21 additions & 3 deletions tests/unit/test_tableclasses_cql_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def test_multi_clustering_column_metadata_vector_cassandra_table(
[
(
"SELECT * FROM k.tn WHERE metadata_s[?] = ? AND partition_id = ? ;", # noqa: E501
("link_{\"kind\": \"kw\"}", "link", "MD_JSON_KEY"),
('link_{"kind": "kw"}', "link", "MD_JSON_KEY"),
),
]
)
Expand Down Expand Up @@ -759,7 +759,17 @@ def test_clustered_elastic_metadata_vector_cassandra_table(
[
(
"SELECT * FROM k.tn WHERE metadata_s[?] = ? AND metadata_s[?] = ? AND metadata_s[?] = ? AND key_desc = ? AND key_vals = ? AND partition_id = ? ;", # noqa: E501
("mdke", "true", "mdkn", "123.0", "mdks", "mdv", '["a","b"]', '["MDA","MDB"]', "MDPART"),
(
"mdke",
"true",
"mdkn",
"123.0",
"mdks",
"mdv",
'["a","b"]',
'["MDA","MDB"]',
"MDPART",
),
),
]
)
Expand Down Expand Up @@ -836,7 +846,15 @@ def test_clustered_elastic_metadata_vector_cassandra_table(
[
(
"SELECT * FROM k.tn WHERE metadata_s[?] = ? AND metadata_s[?] = ? AND key_desc = ? AND key_vals = ? AND partition_id = ? ;", # noqa: E501
("mdke", "true", "mdke2", "true", '["a","b"]', '["MDA","MDB"]', "MDPART"),
(
"mdke",
"true",
"mdke2",
"true",
'["a","b"]',
'["MDA","MDB"]',
"MDPART",
),
),
]
)
Expand Down

0 comments on commit b02358d

Please sign in to comment.