normlite.sql.ddl

Module Contents

class normlite.sql.ddl._ColumnMetadata[source]

Lightweight view over one DBAPI column metadata row.

name: str
type_code: Any
col_id: str | None
args: dict | None
value: Any
classmethod from_row(row: tuple[Any, Ellipsis]) _ColumnMetadata[source]
is_special() bool[source]
is_user_property() bool[source]
type_engine()[source]

Return a TypeEngine instance, using the global type mapper.

class normlite.sql.ddl.HasTableMixin[source]

Mixin for objects that have a normlite.sql.schema.Table object.

Added in version 0.8.0.

get_table() normlite.sql.schema.Table[source]
class normlite.sql.ddl.ExecutableDDLStatement[source]

Bases: HasTableMixin, normlite.sql.base.Executable

Base class for all DDL executable statements.

Added in version 0.8.0: This class is a convenient base class to set the is_ddl for all subclasses.

is_ddl = True

True if the executable subclass is a DDL statement.

Added in version 0.8.0.

_table = None
_execute_on_connection(connection: normlite.engine.base.Connection, params: normlite.engine.interfaces._CoreAnyExecuteParams | None, *, execution_options: dict | None = None) normlite.engine.cursor.CursorResult[source]
class normlite.sql.ddl.CreateTable(table: normlite.sql.schema.Table)[source]

Bases: ExecutableDDLStatement

Represent a CREATE TABLE statement.

Changed in version 0.8.0: This version runs on the new normlite.engine.base.Connection execution pipeline.

Added in version 0.7.0.

__visit_name__ = 'create_table'

Class attribute used to denote the visit method to be called during compilation.

_table
_setup_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to setup execution.

Subclasses shall use this hook method to prepare the execution and store execution-related data in execution context.

Added in version 0.8.0.

_finalize_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to finalize execution.

Subclasses shall use this hook method to finalize results and store execution-related data in execution context.

Added in version 0.8.0.

class normlite.sql.ddl.DropTable(table: normlite.sql.schema.Table)[source]

Bases: ExecutableDDLStatement

Represent a DROP TABLE statement.

Added in version 0.8.0.

__visit_name__ = 'drop_table'

Class attribute used to denote the visit method to be called during compilation.

_table
_setup_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to setup execution.

Subclasses shall use this hook method to prepare the execution and store execution-related data in execution context.

Added in version 0.8.0.

_handle_dbapi_error(exc: normlite.notiondbapi.dbapi2.Error, context: normlite.engine.context.ExecutionContext) NoReturn | None[source]

Handle the DBAPI error that may occur during execution.

Parameters:
  • exc (Error) – The error to be handled

  • context (ExecutionContext) – The execution context in which this executables is running.

Returns:

Nothin

Return type:

Optional[NoReturn]

_finalize_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to finalize execution.

Subclasses shall use this hook method to finalize results and store execution-related data in execution context.

Added in version 0.8.0.

class normlite.sql.ddl.ReflectTable(table: normlite.sql.schema.Table)[source]

Bases: ExecutableDDLStatement

Represent a convenient pseudo DDL statement to reflect a Notion database into a Python normlite.sql.schema.Table object.

Added in version 0.8.0.

__visit_name__ = 'reflect_table'

Class attribute used to denote the visit method to be called during compilation.

_reflected_table

The normlite.sql.schema.Table object to be reflected.

_reflected_table_info = None

The reflected info data structure holding the reflected columns.

_setup_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to setup execution.

Subclasses shall use this hook method to prepare the execution and store execution-related data in execution context.

Added in version 0.8.0.

_finalize_execution(context: normlite.engine.context.ExecutionContext) None[source]

Per-statement internal hook to finalize execution.

Subclasses shall use this hook method to finalize results and store execution-related data in execution context.

Added in version 0.8.0.

_as_info() normlite.sql.reflection.ReflectedTableInfo[source]
get_table() normlite.sql.schema.Table[source]