summaryrefslogtreecommitdiffstats
path: root/sqlglot/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/schema.py')
-rw-r--r--sqlglot/schema.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/sqlglot/schema.py b/sqlglot/schema.py
index 13f72d6..1fd4025 100644
--- a/sqlglot/schema.py
+++ b/sqlglot/schema.py
@@ -106,19 +106,6 @@ class Schema(abc.ABC):
name = column if isinstance(column, str) else column.name
return name in self.column_names(table, dialect=dialect, normalize=normalize)
- @abc.abstractmethod
- def find(self, table: exp.Table, raise_on_missing: bool = True) -> t.Optional[t.Any]:
- """
- Returns the schema of a given table.
-
- Args:
- table: the target table.
- raise_on_missing: whether or not to raise in case the schema is not found.
-
- Returns:
- The schema of the target table.
- """
-
@property
@abc.abstractmethod
def supported_table_args(self) -> t.Tuple[str, ...]:
@@ -170,6 +157,16 @@ class AbstractMappingSchema:
return [table.text(part) for part in exp.TABLE_PARTS if table.text(part)]
def find(self, table: exp.Table, raise_on_missing: bool = True) -> t.Optional[t.Any]:
+ """
+ Returns the schema of a given table.
+
+ Args:
+ table: the target table.
+ raise_on_missing: whether or not to raise in case the schema is not found.
+
+ Returns:
+ The schema of the target table.
+ """
parts = self.table_parts(table)[0 : len(self.supported_table_args)]
value, trie = in_trie(self.mapping_trie, parts)