mirror of
https://github.com/datahub-project/datahub.git
synced 2025-09-15 12:12:07 +00:00
fix(ingest/bigquery): Remove table name restrictions (allow $ and @) (#9030)
This commit is contained in:
parent
75108ceb2f
commit
da6cc54d63
@ -3,7 +3,7 @@ import logging
|
|||||||
import re
|
import re
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from datetime import datetime
|
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
|
from dateutil import parser
|
||||||
|
|
||||||
@ -35,8 +35,6 @@ class BigqueryTableIdentifier:
|
|||||||
dataset: str
|
dataset: str
|
||||||
table: str
|
table: str
|
||||||
|
|
||||||
invalid_chars: ClassVar[Set[str]] = {"$", "@"}
|
|
||||||
|
|
||||||
# Note: this regex may get overwritten by the sharded_table_pattern config.
|
# Note: this regex may get overwritten by the sharded_table_pattern config.
|
||||||
# The class-level constant, however, will not be overwritten.
|
# The class-level constant, however, will not be overwritten.
|
||||||
_BIGQUERY_DEFAULT_SHARDED_TABLE_REGEX: ClassVar[
|
_BIGQUERY_DEFAULT_SHARDED_TABLE_REGEX: ClassVar[
|
||||||
@ -105,18 +103,7 @@ class BigqueryTableIdentifier:
|
|||||||
)
|
)
|
||||||
|
|
||||||
table_name, _ = self.get_table_and_shard(shortened_table_name)
|
table_name, _ = self.get_table_and_shard(shortened_table_name)
|
||||||
if not table_name:
|
return table_name or self.dataset
|
||||||
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
|
|
||||||
|
|
||||||
def get_table_name(self) -> str:
|
def get_table_name(self) -> str:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user