tabsdata.PostgresSource#

class PostgresSource(uri: str, query: str | List[str], credentials: UserPasswordCredentials | None = None, initial_values: dict | None = None)[source]#

Bases: SourcePlugin

Class for managing the configuration of Postgres-based data inputs.

credentials#

The credentials required to access the Postgres database.

Type:

UserPasswordCredentials

initial_values#

The initial values for the parameters in the SQL queries.

Type:

dict

query#

The SQL query(s) to execute. If multiple queries are provided, they must be provided as a dictionary, with the parameter name in the registered function as the key and the SQL query as the value.

Type:

str | List[str]

uri#

The URI of the database where the data is located.

Type:

str

__init__(uri: str, query: str | List[str], credentials: UserPasswordCredentials | None = None, initial_values: dict | None = None)[source]#
Initializes the PostgresSource with the given URI and query, and optionally

connection credentials and initial values for the parameters in the SQL queries.

Parameters:
  • uri (str) – The URI of the database where the data is located

  • query (str | List[str]) – The SQL query(s) to execute. If multiple queries are provided, they must be provided as a list, and they will be mapped to the function inputs in the same order as they are defined.

  • credentials (UserPasswordCredentials, optional) – The credentials required to access the Postgres database. Must be a UserPasswordCredentials object.

  • initial_values (dict, optional) – The initial values for the parameters in the SQL queries.

Raises:

InputConfigurationError

Methods

__init__(uri, query[, credentials, ...])

Initializes the PostgresSource with the given URI and query, and optionally

chunk(working_dir)

Trigger the import of the data. This must be implemented in any class that

stream(working_dir)

Attributes

credentials

The credentials required to access the PostgresDatabase.

initial_values

The initial values for the parameters in the SQL queries.

query

The SQL query(s) to execute.

uri

The URI of the database where the data is located.