:py:mod:`dissect.sql.utils` =========================== .. py:module:: dissect.sql.utils Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: dissect.sql.utils.split_sql_list dissect.sql.utils.parse_table_columns_constraints dissect.sql.utils.split_column_def dissect.sql.utils.get_primary_key_from_constraint .. py:function:: split_sql_list(sql: str) -> Iterator[str] Split a string on comma's (`,') while ignoring any comma's contained within an arbitrary level of nested braces (`( )') .. py:function:: parse_table_columns_constraints(sql: str) -> tuple[Optional[str], list[str], list[str]] Parse SQL CREATE TABLE statements and return the primary key, column definitions and table constraints. The retrun value is a tuple of: (primary_key, [column, ...], [table_constraint, ...]) where column is a tuple of: (column_name, column_type_constraint) .. py:function:: split_column_def(sql: str, column_def: str) -> Tuple[str, str] Splits the column definition to name and constraint. .. py:function:: get_primary_key_from_constraint(column_type_constraint: str, column_def: str, sql: str) -> Optional[str] Finds a primary key from sql string.