From 09233a513de82e3f49378a24e27ca7801844d6ed Mon Sep 17 00:00:00 2001 From: Torsten Kilias Date: Sat, 17 Feb 2024 11:41:47 +0100 Subject: [PATCH] Extract ConnectionName into its own module to prevent circular import --- .../query_handler/context/connection_name.py | 18 +++++++++++++++++ .../context/connection_name_proxy.py | 20 +------------------ .../context/query_handler_context.py | 2 +- .../top_level_query_handler_context.py | 4 ++-- .../query/drop_connection_query.py | 5 +---- 5 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 exasol_advanced_analytics_framework/query_handler/context/connection_name.py diff --git a/exasol_advanced_analytics_framework/query_handler/context/connection_name.py b/exasol_advanced_analytics_framework/query_handler/context/connection_name.py new file mode 100644 index 00000000..faf60f20 --- /dev/null +++ b/exasol_advanced_analytics_framework/query_handler/context/connection_name.py @@ -0,0 +1,18 @@ +from exasol_data_science_utils_python.schema.dbobject_name import DBObjectName +from exasol_data_science_utils_python.schema.dbobject_name_impl import DBObjectNameImpl +from typeguard import typechecked + + +class ConnectionName(DBObjectName): + """A DBObjectName class which represents the name of a connection object""" + + @typechecked + def __init__(self, connection_name: str): + super().__init__(connection_name.upper()) + + +class ConnectionNameImpl(DBObjectNameImpl, ConnectionName): + + @typechecked + def __init__(self, connection_name: str): + super().__init__(connection_name) diff --git a/exasol_advanced_analytics_framework/query_handler/context/connection_name_proxy.py b/exasol_advanced_analytics_framework/query_handler/context/connection_name_proxy.py index 017d6e97..c85ce2e9 100644 --- a/exasol_advanced_analytics_framework/query_handler/context/connection_name_proxy.py +++ b/exasol_advanced_analytics_framework/query_handler/context/connection_name_proxy.py @@ -1,27 +1,9 @@ -from exasol_data_science_utils_python.schema.dbobject_name import DBObjectName -from exasol_data_science_utils_python.schema.dbobject_name_impl import DBObjectNameImpl -from typeguard import typechecked - +from exasol_advanced_analytics_framework.query_handler.context.connection_name import ConnectionName from exasol_advanced_analytics_framework.query_handler.context.proxy.db_object_name_proxy import DBObjectNameProxy from exasol_advanced_analytics_framework.query_handler.query.drop_connection_query import DropConnectionQuery from exasol_advanced_analytics_framework.query_handler.query.query import Query -class ConnectionName(DBObjectName): - """A DBObjectName class which represents the name of a connection object""" - - @typechecked - def __init__(self, connection_name: str): - super().__init__(connection_name.upper()) - - -class ConnectionNameImpl(DBObjectNameImpl, ConnectionName): - - @typechecked - def __init__(self, connection_name: str): - super().__init__(connection_name) - - class ConnectionNameProxy(DBObjectNameProxy[ConnectionName], ConnectionName): def get_cleanup_query(self) -> Query: diff --git a/exasol_advanced_analytics_framework/query_handler/context/query_handler_context.py b/exasol_advanced_analytics_framework/query_handler/context/query_handler_context.py index 90527ff5..49015e34 100644 --- a/exasol_advanced_analytics_framework/query_handler/context/query_handler_context.py +++ b/exasol_advanced_analytics_framework/query_handler/context/query_handler_context.py @@ -5,7 +5,7 @@ from exasol_data_science_utils_python.schema.udf_name import UDFName from exasol_data_science_utils_python.schema.view_name import ViewName -from exasol_advanced_analytics_framework.query_handler.context.connection_name_proxy import ConnectionName +from exasol_advanced_analytics_framework.query_handler.context.connection_name import ConnectionName from exasol_advanced_analytics_framework.query_handler.context.proxy.bucketfs_location_proxy import \ BucketFSLocationProxy diff --git a/exasol_advanced_analytics_framework/query_handler/context/top_level_query_handler_context.py b/exasol_advanced_analytics_framework/query_handler/context/top_level_query_handler_context.py index 1721841a..530c69fc 100644 --- a/exasol_advanced_analytics_framework/query_handler/context/top_level_query_handler_context.py +++ b/exasol_advanced_analytics_framework/query_handler/context/top_level_query_handler_context.py @@ -12,8 +12,8 @@ from exasol_data_science_utils_python.schema.view_name import ViewName from exasol_data_science_utils_python.schema.view_name_builder import ViewNameBuilder -from exasol_advanced_analytics_framework.query_handler.context.connection_name_proxy import ConnectionName, \ - ConnectionNameProxy, ConnectionNameImpl +from exasol_advanced_analytics_framework.query_handler.context.connection_name_proxy import ConnectionNameProxy +from exasol_advanced_analytics_framework.query_handler.context.connection_name import ConnectionName, ConnectionNameImpl from exasol_advanced_analytics_framework.query_handler.context.proxy.bucketfs_location_proxy import \ BucketFSLocationProxy from exasol_advanced_analytics_framework.query_handler.context.proxy.db_object_name_proxy import DBObjectNameProxy diff --git a/exasol_advanced_analytics_framework/query_handler/query/drop_connection_query.py b/exasol_advanced_analytics_framework/query_handler/query/drop_connection_query.py index f59cf434..e7f61766 100644 --- a/exasol_advanced_analytics_framework/query_handler/query/drop_connection_query.py +++ b/exasol_advanced_analytics_framework/query_handler/query/drop_connection_query.py @@ -1,7 +1,4 @@ -from exasol_data_science_utils_python.schema.table_name import TableName -from exasol_data_science_utils_python.schema.view_name import ViewName - -from exasol_advanced_analytics_framework.query_handler.context.connection_name_proxy import ConnectionName +from exasol_advanced_analytics_framework.query_handler.context.connection_name import ConnectionName from exasol_advanced_analytics_framework.query_handler.query.drop_query import DropQuery