Skip to content

Commit f09c3cb

Browse files
committed
fixup! Make BigQuery prefix matching case-insensitive
1 parent d0f0a94 commit f09c3cb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/azul/plugins/repository/canned/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def count_bundles(self, source: CannedSourceRef) -> int:
164164
return len(staging_area.links)
165165
else:
166166
prefix = source.spec.prefix.common
167-
assert not any(map(str.isupper, prefix)), source
167+
assert prefix == prefix.lower(), source
168168
return sum(
169169
1
170170
for links_id in staging_area.links
@@ -177,7 +177,7 @@ def list_bundles(self,
177177
) -> list[CannedBundleFQID]:
178178
self._assert_source(source)
179179
self._assert_partition(source, prefix)
180-
assert not any(map(str.isupper, prefix)), prefix
180+
assert prefix == prefix.lower(), prefix
181181
staging_area = self.staging_area(source.spec.name)
182182
return [
183183
CannedBundleFQID(source=source,

src/azul/plugins/repository/tdr_anvil/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def _batch_uuid(self,
243243

244244
def count_bundles(self, source: TDRSourceSpec) -> int:
245245
prefix = '' if source.prefix is None else source.prefix.common
246-
assert not any(map(str.isupper, prefix)), source
246+
assert prefix == prefix.lower(), source
247247
primary_count = one(self._run_sql(f'''
248248
SELECT COUNT(*) AS count
249249
FROM {backtick(self._full_table_name(source, BundleType.primary.value))}
@@ -264,7 +264,7 @@ def list_bundles(self,
264264
) -> list[TDRAnvilBundleFQID]:
265265
self._assert_source(source)
266266
self._assert_partition(source, prefix)
267-
assert not any(map(str.isupper, prefix)), prefix
267+
assert prefix == prefix.lower(), prefix
268268
bundles = []
269269
spec = source.spec
270270

@@ -357,7 +357,7 @@ def _batch_tables(self,
357357
this affects this method's return value is very small, but nonzero.
358358
https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#avg
359359
"""
360-
assert not any(map(str.isupper, prefix)), prefix
360+
assert prefix == prefix.lower(), prefix
361361
max_length = 4
362362

363363
def repeat(fmt):

src/azul/plugins/repository/tdr_hca/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class Plugin(TDRPlugin[TDRHCABundle, TDRBundleFQID]):
233233

234234
def count_bundles(self, source: TDRSourceSpec) -> int:
235235
prefix = '' if source.prefix is None else source.prefix.common
236-
assert not any(map(str.isupper, prefix)), source
236+
assert prefix == prefix.lower(), source
237237
query = f'''
238238
SELECT COUNT(*) AS count
239239
FROM {backtick(self._full_table_name(source, 'links'))}
@@ -248,7 +248,7 @@ def list_bundles(self,
248248
) -> list[TDRBundleFQID]:
249249
self._assert_source(source)
250250
self._assert_partition(source, prefix)
251-
assert not any(map(str.isupper, prefix)), source
251+
assert prefix == prefix.lower(), source
252252
current_bundles = self._query_unique_sorted(f'''
253253
SELECT links_id, version
254254
FROM {backtick(self._full_table_name(source.spec, 'links'))}

0 commit comments

Comments
 (0)