msticpy.data.core.query_provider_connections_mixin module

Query Provider additional connection methods.

class msticpy.data.core.query_provider_connections_mixin.QueryProviderConnectionsMixin(*args, **kwargs)

Bases: QueryProviderProtocol

Mixin additional connection handling QueryProvider class.

add_connection(connection_str: str | None = None, alias: str | None = None, **kwargs)

Add an additional connection for the query provider.

Parameters:
  • connection_str (Optional[str], optional) – Connection string for the provider, by default None

  • alias (Optional[str], optional) – Alias to use for the connection, by default None

  • kwargs (Dict[str, Any]) – Other connection parameters passed to the driver.

Notes

Some drivers may accept types other than strings for the connection_str parameter.

driver_class: Any
exec_query(query: str, **kwargs) DataFrame | Any

Execute simple query string.

Parameters:
  • query (str) – [description]

  • use_connections (Union[str, List[str]])

  • query_options (Dict[str, Any]) – Additional options passed to query driver.

  • kwargs (Dict[str, Any]) – Additional options passed to query driver.

Returns:

Query results - a DataFrame if successful or a KqlResult if unsuccessful.

Return type:

Union[pd.DataFrame, Any]

list_connections() List[str]

Return a list of current connections.

Returns:

The alias and connection string for each connection.

Return type:

List[str]

class msticpy.data.core.query_provider_connections_mixin.QueryProviderProtocol(*args, **kwargs)

Bases: Protocol

Protocol for required properties of QueryProvider class.

driver_class: Any