dr_data.biopsy package

Module contents

class dr_data.biopsy.Biopsy(configuration)[source]

Bases: object

Explicitly exports a schema and table insertion-order JSON files

build_columns(table_name, table_schema_name='public')[source]

This queries the database and build a list of columns per table. :param table_name: Name of the table :type table_name: str :param table_schema_name: The schema name, default is public :type table_schema_name: str :return: Dictionary of column data per table. :rtype: dict

build_insertion_order_schema()[source]

Builds a JSON insertion schema from the JSON schema :return: a insertion order dictionary of tables and columns :rtype: dict

build_schema(table_schema_name='public')[source]

Builds a JSON schema from the database tables and columns :param table_schema_name: The schema name, default is public :type table_schema_name: str :return: a dictionary of tables and columns :rtype: dict

build_tables(table_schema_name='public')[source]

This queries the database and gets the list of tables and related table data :param table_schema_name: The schema name, default is public :type table_schema_name: str :return: list of tables and table schema information :rtype: list[str]

execute_cmd()[source]

Executes the biopsy command, main entry point :return: tuple of db schema and insertion order schema :rtype: tuple

get_column_constraint(table_name, column_name, table_schema_name='public')[source]

This queries the database getting column constraints per table. :param table_name: The name of the table :type table_name: str :param column_name: The name of the column :type column_name: str :param table_schema_name: The schema name, default is public :type table_schema_name: str :return: Dictionary of colum constraints. :rtype: dict

get_insertion_table_order()[source]

This queries the database and gets the table insertion order :return: ordered insetion list of table names :rtype: list[str]

get_values_from_type(type)[source]

This queries the database gettting the types from value :param type: The name of the type :type type: str :return: List of types :rtype: list[str]