Skip to content

Commit

Permalink
fix(ingest/bigquery): Remove table name restrictions (allow $ and @) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
asikowitz authored Oct 17, 2023
1 parent 75108ce commit da6cc54
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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

Expand Down Expand Up @@ -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[
Expand Down Expand Up @@ -105,18 +103,7 @@ def get_table_display_name(self) -> str:
)

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:
"""
Expand Down

0 comments on commit da6cc54

Please sign in to comment.