ploomber.products.PostgresRelation

class ploomber.products.PostgresRelation(identifier, client=None)

A PostgreSQL relation

Parameters:
  • identifier (tuple of length 3) – A tuple with (schema, name, kind) where kind must be either ‘table’ or ‘view’

  • client (ploomber.clients.DBAPIClient or SQLAlchemyClient, optional) – The client used to connect to the database. Only required if no dag-level client has been declared using dag.clients[class]

Examples

>>> from ploomber.products import PostgresRelation
>>> relation = PostgresRelation(('schema', 'some_table', 'table'))
>>> str(relation) # returns qualified name
'schema.some_table'

Methods

delete([force])

Deletes the product

download()

exists()

This method returns True if the product exists, it is not part of the metadata, so there is no cached status

fetch_metadata()

render(params, **kwargs)

Render Product - this will render contents of Templates used as identifier for this Product, if a regular string was passed, this method has no effect

save_metadata(metadata)

to_json_serializable()

Returns a JSON serializable version of this product

upload()

delete(force=False)

Deletes the product

download()
exists()

This method returns True if the product exists, it is not part of the metadata, so there is no cached status

fetch_metadata()
render(params, **kwargs)

Render Product - this will render contents of Templates used as identifier for this Product, if a regular string was passed, this method has no effect

save_metadata(metadata)
to_json_serializable()

Returns a JSON serializable version of this product

upload()

Attributes

client

kind

name

schema

task