Connectors

In the following we provide the reference for all currently available connectors.

Amazon

You can install the Amazon connectors through the amazon extra:

pip install stormware[amazon]

Note

All Amazon connectors use the AWS credentials that are obtained through the authentication mechanism described in the Amazon Web Services section of the authentication documentation.

AWS Secrets Manager

class stormware.amazon.secrets.SecretsManager(organization: str | None = None, auth: AWSAuth | None = None)

AWS Secrets Manager connector.

Parameters:
  • organization – The default organization to use.

  • auth – The Amazon Web Services authentication manager to use.

__getitem__(key: str) str

Retrieve the secret under the given key.

Facebook

You can install the Facebook connectors through the facebook extra:

pip install stormware[facebook]
class stormware.facebook.FacebookAds(account_name: str | None = None, secret_key: str = 'stormware-facebook', secret_store: SecretStore | None = None)

Facebook Ads connector.

Parameters:
  • account_name – The name of the ad account to use.

  • secret_key – The key of the credentials in the secret store.

  • secret_store – The secret store to use for retrieving the credentials. Uses the default secret store when not provided.

Authentication

The session credentials are loaded from the secret store using the provided key. The secret must be a string-encoded JSON object with the app_id, app_secret and access_token keys. The app ID and app secret can be obtained by creating a Facebook App (under https://developers.facebook.com/apps/), after which we recommend creating a system user (under https://business.facebook.com/settings/system-users/), which can be then used to generate an access token. Note that the system user must have access to the necessary ad accounts and it must be also added to the appropriate app as an app tester.

account_id(account_name: str | None = None) str

Return the account ID for a given account name.

report(*, metrics: list[str], dimensions: list[str] | None = None, statistics: list[str] | None = None, parameters: dict[str, Any] | None = None, account_name: str | None = None, account_id: str | None = None) DataFrame

Return a Facebook report.

Parameters:

Google

You can install the Google connectors through the google extra:

pip install stormware[google]

Note

All Google connectors use the Google credentials that are obtained through the authentication mechanism described in the Google Cloud Platform section of the authentication documentation.

Google BigQuery

class stormware.google.bigquery.BigQuery(organization: str | None = None, project: str | None = None, auth: GCPAuth | None = None)

Google BigQuery connector.

Must be used with a context manager.

Parameters:
  • organization – The organization to use.

  • project – The project to use.

  • auth – The Google Cloud Platform authentication manager to use.

get_table(name: str) DataFrame

Return the given table as a data frame.

set_table(name: str, data: DataFrame) None

Upload the given data frame to a table.

Existing data in the table is dropped.

Google Secret Manager

class stormware.google.secrets.SecretManager(organization: str | None = None, project: str | None = None, auth: GCPAuth | None = None)

Google Cloud Secret Manager connector.

Must be used with a context manager.

Parameters:
  • organization – The default organization to use.

  • project – The default project to use.

  • auth – The Google Cloud Platform authentication manager to use.

__getitem__(key: str) str

Retrieve the secret under the given key.

Google Sheets

class stormware.google.sheets.Spreadsheet(key: str, organization: str | None = None, project: str | None = None, auth: GCPAuth | None = None)

Google Sheets connector.

Must be used with a context manager.

Parameters:
  • key – The spreadsheet ID to use.

  • organization – The organization to use.

  • project – The project to use.

  • auth – The Google Cloud Platform authentication manager to use. Note that the credentials must be authorized for the https://www.googleapis.com/auth/spreadsheets scope.

add_sheet(name: str, properties: dict[str, Any] | None = None) int

Add a new sheet to the spreadsheet.

delete_sheet(name: str, ignore_missing: bool = True) None

Delete a sheet from the spreadsheet.

get_sheet(name: str) DataFrame

Return the given sheet as a data frame.

set_sheet(name: str, data: DataFrame) None

Upload the given data frame to a sheet.

Create a new sheet if necessary. Existing data in the sheet is dropped.