dissect.sql.utils
#
Module Contents#
Functions#
Split a string on comma's (`,') while ignoring any comma's contained |
|
Parse SQL CREATE TABLE statements and return the primary key, column |
|
Splits the column definition to name and constraint. |
|
Finds a primary key from sql string. |
- dissect.sql.utils.split_sql_list(sql)#
Split a string on comma’s (`,’) while ignoring any comma’s contained within an arbitrary level of nested braces (`( )’)
- dissect.sql.utils.parse_table_columns_constraints(sql)#
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)
- dissect.sql.utils.split_column_def(sql: str, column_def: str) Tuple[str, str] #
Splits the column definition to name and constraint.
- dissect.sql.utils.get_primary_key_from_constraint(column_type_constraint: str, column_def: str, sql: str) str | None #
Finds a primary key from sql string.