-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
16 changed files
with
608 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
exasol_advanced_analytics_framework/udf_framework/udf_connection_lookup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from exasol_advanced_analytics_framework.query_handler.context.scope_query_handler_context import Connection | ||
|
||
|
||
class UDFConnection(Connection): | ||
|
||
def __init__(self, name: str, udf_connection): | ||
self._udf_connection = udf_connection | ||
self._name = name | ||
|
||
@property | ||
def name(self) -> str: | ||
return self._name | ||
|
||
@property | ||
def address(self) -> str: | ||
return self._udf_connection.address | ||
|
||
@property | ||
def user(self) -> str: | ||
return self._udf_connection.user | ||
|
||
@property | ||
def password(self) -> str: | ||
return self._udf_connection.password | ||
|
||
|
||
class UDFConnectionLookup: | ||
def __init__(self, exa): | ||
self.exa = exa | ||
|
||
def __getstate__(self): | ||
result = self.__dict__.copy() | ||
del result["exa"] | ||
return result | ||
|
||
def __call__(self, name: str): | ||
udf_connection = self.exa.get_connection(name) | ||
return UDFConnection(name, udf_connection) |
Oops, something went wrong.