bi_etl.utility.postgresql.psycopg2_helpers module

bi_etl.utility.postgresql.psycopg2_helpers.get_conn(dbname, username, password, encoding='UTF-8')[source]
bi_etl.utility.postgresql.psycopg2_helpers.get_cursor(dbname, username, password, encoding='UTF-8')[source]
bi_etl.utility.postgresql.psycopg2_helpers.psycopg2_extract_using_engine(engine: Engine, table_or_query: str, output_file_path: str | Path, delimiter: str = '|', csv_mode: bool = True, header: bool = True, null: str = '', encoding='UTF-8')[source]
Parameters:
  • engine

  • table_or_query – table_name [ ( column_name [, …] ) or (SQL Query) For table based, column names are optional. For SQL query based, note that parentheses and quotes are required around the query.

  • output_file_path

  • delimiter

  • csv_mode

  • header

  • null

  • encoding

bi_etl.utility.postgresql.psycopg2_helpers.psycopg2_import_using_cursor(cursor, table_spec: str, input_file_path: str | Path, block_size: int = 4096, delimiter: str = '|', csv_mode: bool = True, header: bool = True, null: str = '', encoding='UTF-8')[source]
Parameters:
  • cursor

  • table_spec – table_name [ ( column_name [, …] ) Column names are optional unless the columns in the file do not match the order or set of columns in the table.

  • input_file_path

  • block_size

  • delimiter

  • csv_mode

  • header

  • null

  • encoding

bi_etl.utility.postgresql.psycopg2_helpers.psycopg2_import_using_engine(engine: Engine, table_spec: str, input_file_path: str | Path, block_size: int = 4096, delimiter: str = '|', csv_mode: bool = True, header: bool = True, null: str = '', encoding='UTF-8')[source]
Parameters:
  • engine

  • table_spec – table_name [ ( column_name [, …] ) Column names are optional unless the columns in the file do not match the order or set of columns in the table.

  • input_file_path

  • block_size

  • delimiter

  • csv_mode

  • header

  • null

  • encoding