pirogue.utils.select_columns

pirogue.utils.select_columns(pg_cur: cursor, table_schema: str, table_name: str, table_type: str = 'table', table_alias: str | None = None, remove_pkey: bool = False, skip_columns: list = [], safe_skip_columns: list = [], columns_list: list | None = None, comment_skipped: bool = True, remap_columns: dict = {}, columns_on_top: list = [], columns_at_end: list = [], prefix: str | None = None, indent: int = 2, separate_first: bool = False) str[source]

Returns the list of columns to be used in a SELECT command

Parameters:
  • pg_cur – the psycopg cursor

  • table_schema – the schema

  • table_name – the name of the table

  • table_type – the type of table, i.e. view or table

  • table_alias – if not specified, table is used

  • remove_pkey – if True, the primary is removed from the list

  • skip_columns – list of columns to be skipped, raise an exception if the column does not exist

  • safe_skip_columns – list of columns to be skipped, do not raise exception if column does not exist

  • columns_list – if given use as list of columns

  • comment_skipped – if True, skipped columns are written but commented, otherwise they are not written If remove_pkey is True, the primary key will not be printed

  • remap_columns – dictionary to remap columns

  • columns_on_top – bring the columns to the front of the list

  • columns_at_end – bring the columns to the end of the list

  • prefix – add a prefix to the columns (do not applied to remapped columns)

  • indent – add an indent in front

  • separate_first – separate the first column with a comma