connector_utils module

connector_test_connection(connector_name, connector_type=ConnectionType.DATABASE, auth_type=AuthType.BASIC, **auth_params)

Tests the connection to the specified connector.

Parameters:
  • connector_name (str) – The name of the connector.

  • connector_type (ConnectionType) – The type of connector, defaults to ConnectionType.DATABASE.

Returns:

True if the connection is successful, False otherwise.

Return type:

bool

fetch_data_from_connector(connector_name, auth_values, auth_type, table, connection_type, schema='public', page_limit=10000)

Fetches data from a connector based on the provided connection details.

Parameters:
  • connection_name (str) – The name of the connection.

  • connection_type (str) – The type of the connection.

  • table (str) – The name of the table to fetch data from.

  • schema (str, optional) – The schema of the table. Defaults to “public”.

  • page_limit (int, optional) – The maximum number of pages to fetch. Defaults to 10000.

Returns:

None

fetch_metadata(connection, auth_options, connection_type)

Fetch metadata from the given connection.

Parameters:

connections (string) – name of the connection

Returns:

{“tables”: [],”schema”:[]}

Return type:

dict

get_connector_auth_details(connector_name, connector_type=ConnectionType.DATABASE)

Returns the authentication details for the specified connector.

Parameters:
  • connector_name (str) – The name of the connector.

  • connector_type (ConnectionType) – The type of connector, defaults to ConnectionType.DATABASE.

Returns:

A dictionary containing the authentication details for the specified connector.

Return type:

dict

get_connector_engine(connector_name, connector_type=ConnectionType.DATABASE)

Returns the engine for the specified connector.

Parameters:
  • connector_name (str) – The name of the connector.

  • connector_type (ConnectionType) – The type of connector, defaults to ConnectionType.DATABASE.

Returns:

The engine for the specified connector.

Return type:

object

get_connector_image(connector_name, connection_type)

Fetch metadata from the given connection.

Parameters:

connections (string) – name of the connection

Returns:

{“tables”: [],”schema”:[]}

Return type:

dict

get_connector_metadata(connector_name, connector_type='database')

Returns the metadata for the specified connector.

Parameters:
  • connector_name (str) – The name of the connector.

  • connector_type (ConnectionType) – The type of connector, defaults to ConnectionType.DATABASE.

Returns:

A dictionary containing the metadata for the specified connector.

Return type:

dict

get_created_connections(connector_type='database', connection_name=None)

Returns a list of created connections for the specified connector type.

Parameters:
  • connection_name (str)

  • connector_type (ConnectionType) – The value of type of connector, defaults to ConnectionType.DATABASE.value

Returns:

A list of created connections.

Return type:

list

get_db_connector_engine(connector_name)
get_installed_connectors(connector_type=ConnectionType.DATABASE)

Checks the available connectors based on the specified connector type.

Parameters:

connector_type (ConnectionType) – The type of connector to check, defaults to ConnectionType.DATABASE.

Returns:

A list of available connectors based on the specified connector type.

Return type:

list

import_module(module_name, module_path, class_name='Connector', *args, **kwargs)

Imports a module and initializes a class within it.

Parameters:
  • module_name (str) – The name of the module (without the .py extension).

  • class_name (str) – The name of the class to initialize.

  • *args – Positional arguments to pass to the class constructor.

  • **kwargs – Keyword arguments to pass to the class constructor.

Returns:

An instance of the initialized class.

Return type:

object

install_libraries(libs)