diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/custom_table.py b/src/snowflake/sqlalchemy/sql/custom_schema/custom_table_base.py similarity index 96% rename from src/snowflake/sqlalchemy/sql/custom_schema/custom_table.py rename to src/snowflake/sqlalchemy/sql/custom_schema/custom_table_base.py index cfafa06e..16c45c26 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/custom_table.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/custom_table_base.py @@ -2,7 +2,6 @@ # Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. # import typing -from abc import ABC from typing import Any from sqlalchemy.exc import ArgumentError @@ -13,7 +12,7 @@ from .options.table_option import TableOption -class CustomTable(Table, ABC): +class CustomTableBase(Table): __table_prefix__ = "" _support_primary_and_foreign_keys = True diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/dynamic_table.py b/src/snowflake/sqlalchemy/sql/custom_schema/dynamic_table.py index ac06ec16..bc9238d5 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/dynamic_table.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/dynamic_table.py @@ -5,17 +5,16 @@ import typing from typing import Any -from sqlalchemy import exc, inspection from sqlalchemy.sql.schema import MetaData, SchemaItem from snowflake.sqlalchemy.custom_commands import NoneType from .options.target_lag import TargetLag from .options.warehouse import Warehouse -from .table_from_query import TableFromQuery +from .table_from_query import TableFromQueryBase -class DynamicTable(TableFromQuery, inspection.Inspectable["DynamicTable"]): +class DynamicTable(TableFromQueryBase): """ A class representing a dynamic table with configurable options and settings. diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/options/as_query.py b/src/snowflake/sqlalchemy/sql/custom_schema/options/as_query.py index bb4cc5be..68076af9 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/options/as_query.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/options/as_query.py @@ -3,7 +3,7 @@ # from typing import Union -from sqlalchemy import Selectable +from sqlalchemy.sql import Selectable from .table_option import TableOption from .table_option_base import Priority diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option.py b/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option.py index d9b28def..a753546d 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option.py @@ -1,7 +1,6 @@ # # Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. # -from abc import ABC from typing import Any from sqlalchemy import exc @@ -13,7 +12,7 @@ from .table_option_base import TableOptionBase -class TableOption(TableOptionBase, SchemaItem, ABC): +class TableOption(TableOptionBase, SchemaItem): def _set_parent(self, parent: SchemaEventTarget, **kw: Any) -> None: if self.__option_name__ == "default": raise exc.SQLAlchemyError(f"{self.__class__.__name__} does not has a name") diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option_base.py b/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option_base.py index ca2c4390..54008ec8 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option_base.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/options/table_option_base.py @@ -1,7 +1,6 @@ # # Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. # -from abc import ABC, abstractmethod from enum import Enum @@ -15,20 +14,17 @@ class Priority(Enum): HIGHEST = 8 -class TableOptionBase(ABC): +class TableOptionBase: __option_name__ = "default" __visit_name__ = __option_name__ __priority__ = Priority.MEDIUM @staticmethod - @abstractmethod def template() -> str: - pass + raise NotImplementedError - @abstractmethod def get_expression(self): - pass + raise NotImplementedError - @abstractmethod def render_option(self, compiler) -> str: - pass + raise NotImplementedError diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/options/target_lag.py b/src/snowflake/sqlalchemy/sql/custom_schema/options/target_lag.py index c68e6e0e..ec30314e 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/options/target_lag.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/options/target_lag.py @@ -1,6 +1,7 @@ # # Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. # from enum import Enum +from enum import Enum from typing import Optional from .table_option import TableOption diff --git a/src/snowflake/sqlalchemy/sql/custom_schema/table_from_query.py b/src/snowflake/sqlalchemy/sql/custom_schema/table_from_query.py index 2c9f2e58..0101206a 100644 --- a/src/snowflake/sqlalchemy/sql/custom_schema/table_from_query.py +++ b/src/snowflake/sqlalchemy/sql/custom_schema/table_from_query.py @@ -2,19 +2,18 @@ # Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. # import typing -from abc import ABC from typing import Any, Optional import sqlalchemy -from sqlalchemy import Selectable +from sqlalchemy.sql import Selectable from sqlalchemy.sql.schema import Column, MetaData, SchemaItem from sqlalchemy.util import NoneType -from .custom_table import CustomTable +from .custom_table_base import CustomTableBase from .options.as_query import AsQuery -class TableFromQuery(CustomTable, ABC): +class TableFromQueryBase(CustomTableBase): @property def as_query(self):