great_expectations.experimental.datasources

Package Contents

Classes

PostgresDatasource(**kwargs)

Postgres datasource

class great_expectations.experimental.datasources.PostgresDatasource(**kwargs)

Bases: great_expectations.experimental.datasources.interfaces.Datasource

Postgres datasource

Parameters
  • name – The name of this datasource

  • connection_str – The SQLAlchemy connection string used to connect to the database. For example: “postgresql+psycopg2://postgres:@localhost/test_database”

  • assets – An optional dictionary whose keys are table asset names and whose values are TableAsset objects.

asset_types :ClassVar[List[Type[DataAsset]]]
type :Literal['postgres'] = postgres
connection_string :str
assets :Dict[str, TableAsset]
execution_engine_type(self)

Returns the default execution engine type.

add_table_asset(self, name: str, table_name: str, order_by: Optional[BatchSortersDefinition] = None)

Adds a table asset to this datasource.

Parameters
  • name – The name of this table asset.

  • table_name – The table where the data resides.

  • order_by – A list of BatchSorters or BatchSorter strings.

Returns

The TableAsset that is added to the datasource.

get_asset(self, asset_name: str)

Returns the TableAsset referred to by name

get_batch_list_from_batch_request(self, batch_request: BatchRequest)

A list of batches that match the BatchRequest.

Parameters

batch_request – A batch request for this asset. Usually obtained by calling get_batch_request on the asset.

Returns

A list of batches that match the options specified in the batch request.