snowshu.adapters.target_adapters.base_target_adapter¶
-
class
snowshu.adapters.target_adapters.base_target_adapter.BaseTargetAdapter¶ Bases:
snowshu.adapters.base_sql_adapter.BaseSQLAdapterAll target adapters inherit from this one.
-
ALLOWED_CREDENTIALS= []¶
-
DOCKER_TARGET_PORT= 9999¶
-
REQUIRED_CREDENTIALS= ['user', 'password', 'host', 'port', 'database']¶
-
create_and_load_relation(relation) → None¶
-
create_database_if_not_exists(database: str) → str¶
-
create_function_if_available(function: str, relations: Iterable[Relation]) → None¶ Applies all available source functions to target.
Looks for a function sql file in ./functions, executes against target for each db if it is.
- Parameters
function – The name of the function, must match the sql file name exactly.
relations – An iterable of relations to apply the function to.
-
create_or_replace_view(relation) → None¶ Creates a view of the specified relation in the target adapter.
Relation must have a valid
view_ddlvalue that can be executed as a SELECT statement.- Parameters
relation – the
Relationobject to be created as a view.
-
create_schema_if_not_exists(database: str, schema: str) → str¶
-
enable_cross_database(relations: Iterable[Relation]) → None¶ Create x-database links, if available to the target.
- Parameters
relations – an iterable of relations to collect databases and schemas from.
-
finalize_replica() → str¶ returns the image name of the completed replica.
-
image_finalize_bash_commands() → List[str]¶ returns an ordered list of raw bash commands used to finalize the image.
For many target images some bash cleanup is required, such as remounting data or setting envars. This method returns the ordered commands to do this finalization.
Note
These commands will be run using bin/bash -c execution.
- Returns
a list of strings to be run against the container in order.
-
initialize_replica(source_adapter_name: str) → None¶ shimming but will want to move _init_image public with this interface.
- Parameters
source_adapter_name – the classname of the source adapter
-
load_data_into_relation(relation: snowshu.core.models.relation.Relation) → None¶
-
target_database_is_ready() → bool¶
-