fix(ingest/bigquery): Remove table name restrictions (allow $ and @) (#9030)

This commit is contained in:
Andrew Sikowitz 2023-10-17 16:18:39 -04:00 committed by GitHub
parent 75108ceb2f
commit da6cc54d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ import logging
import re
from dataclasses import dataclass, field
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Pattern, Set, Tuple, Union
from typing import Any, ClassVar, Dict, List, Optional, Pattern, Tuple, Union
from dateutil import parser
@ -35,8 +35,6 @@ class BigqueryTableIdentifier:
dataset: str
table: str
invalid_chars: ClassVar[Set[str]] = {"$", "@"}
# Note: this regex may get overwritten by the sharded_table_pattern config.
# The class-level constant, however, will not be overwritten.
_BIGQUERY_DEFAULT_SHARDED_TABLE_REGEX: ClassVar[
@ -105,18 +103,7 @@ class BigqueryTableIdentifier:
)
table_name, _ = self.get_table_and_shard(shortened_table_name)
if not table_name:
table_name = self.dataset
# Handle exceptions
invalid_chars_in_table_name: List[str] = [
c for c in self.invalid_chars if c in table_name
]
if invalid_chars_in_table_name:
raise ValueError(
f"Cannot handle {self.raw_table_name()} - poorly formatted table name, contains {invalid_chars_in_table_name}"
)
return table_name
return table_name or self.dataset
def get_table_name(self) -> str:
"""