dipper.sources.PostgreSQLSource module

class dipper.sources.PostgreSQLSource.PostgreSQLSource(graph_type, are_bnodes_skolemized, data_release_version=None, name=None, ingest_title=None, ingest_url=None, ingest_logo=None, ingest_description=None, license_url=None, data_rights=None, file_handle=None)

Bases: dipper.sources.Source.Source

Class for interfacing with remote Postgres databases

fetch(is_dl_forced=False)

abstract method to fetch all data from an external resource. this should be overridden by subclasses :return: None

fetch_from_pgdb(tables, cxn, limit=None)
Will fetch all Postgres tables from the specified database
in the cxn connection parameters.
This will save them to a local file named the same as the table,
in tab-delimited format, including a header.
Parameters:
  • tables – Names of tables to fetch
  • cxn – database connection details
  • limit – A max row count to fetch for each table
Returns:

None

fetch_query_from_pgdb(qname, query, con, cxn, limit=None)

Supply either an already established connection, or connection parameters. The supplied connection will override any separate cxn parameter :param qname: The name of the query to save the output to :param query: The SQL query itself :param con: The already-established connection :param cxn: The postgres connection information :param limit: If you only want a subset of rows from the query :return:

files = {}
parse(limit)

abstract method to parse all data from an external resource, that was fetched in fetch() this should be overridden by subclasses :return: None