plasoscaffolder.dal package

Submodules

plasoscaffolder.dal.base_database_information module

Base class for the Information for the SQLite Database

class plasoscaffolder.dal.base_database_information.BaseDatabaseInformation[source]

Bases: object

Base class representing the SQLite Query validator.

GetTableColumnsAndType(table: str, all_lowercase=False) → [<class 'str'>][source]

Returns the table information from the database

Parameters:
  • table (str) – the name of the table
  • all_lowercase (bool) – if the table name and the type should be returned in lower case
Returns:

the table information, with the name of the column and the

type of the column

Return type:

{name, type}

GetTablesFromDatabase() → [<class 'str'>][source]

Executes the SQL Query and returns all tables from the database.

Returns:the name of the tables
Return type:[str]

plasoscaffolder.dal.base_explain_query_plan module

Base class for the explain query plan.

class plasoscaffolder.dal.base_explain_query_plan.BaseExplainQueryPlan[source]

Bases: object

Base class representing the explain query plan.

GetLockedTables(query: str) → [<class 'str'>][source]

Determines the table that were locked during the SQL query.

Parameters:query (str) – the SQL query to get the locked tables from
Returns:the list of tables
Return type:[str]
IsReadOnly(query: str) → bool[source]

Determines if the query is read only.

Parameters:query (str) – the sql query to determine if it is read only
Returns:true if it is read only, false if it is not
Return type:bool

plasoscaffolder.dal.base_sql_query_execution module

The SQLite Query validator.

class plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution[source]

Bases: object

Class representing the SQLite query validator.

ExecuteQuery(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteQueryDetailed(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query and gets detailed information.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteReadOnlyQuery(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query if it is read only, and valid to parse.

Parameters:query (str) – the SQL Query to execute on the SQLite database
Returns:the data to the Query
Return type:sql_query_data.SQLQueryData
TryToConnect() → bool[source]

Try to open the database File.

Returns:if the file can be opened and is a database file
Return type:bool

plasoscaffolder.dal.base_type_helper module

Base SQLite Type Helper.

class plasoscaffolder.dal.base_type_helper.BaseTypeHelper[source]

Bases: object

Base class representing the type helper for SQLite.

AddMissingTypesFromSchema(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>], query: str) → [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>][source]

Getting Information for the column out of the cursor.

Parameters:
Returns:

a list with all the columns

Return type:

[sql_query_column_model.SQLColumnModel]

GetColumnInformationFromDescription(description: []) → [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>][source]

Getting Information for the column out of the cursor.

Parameters:description – the description of the cursor
Returns:
a list with all the column
names, the types are None
Return type:[sql_query_column_model.SQLColumnModel]
GetDuplicateColumnNames(columns: plasoscaffolder.model.sql_query_column_model.SQLColumnModel) → [<class 'str'>][source]
Find out if the query has duplicate column names and if a alias is
needed.
Parameters:columns (sql_query_column_model.SQLColumnModel) – all columns parsed from the cursor
Returns:
a list of all the duplicate column names, if its empty it means it
is a distinct list of columns
Return type:[str]

plasoscaffolder.dal.explain_query_plan module

Class for the explain query plan.

class plasoscaffolder.dal.explain_query_plan.ExplainQueryPlan(sql_execution: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution)[source]

Bases: plasoscaffolder.dal.base_explain_query_plan.BaseExplainQueryPlan

Class representing the explain query plan.

GetLockedTables(query: str) → [<class 'str'>][source]

Determines the table that were locked during the SQL query.

Parameters:query (str) – the sql query to get the locked tables from
Returns:the list of tables
Return type:[str]
IsReadOnly(query: str) → bool[source]

Determines if the query is read only.

Parameters:query (str) – the sql query to determine if it is read only
Returns:true if it is read only, false if it is not
Return type:bool

plasoscaffolder.dal.sql_query_data module

Data class for the SQL Query

class plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Bases: object

The Data to the executed query.

has_error

bool – if the query execution was erroneous

data

[str] – the rows returned after execution

error_message

str – the error message if the query was erroneous

columns

[sql_query_column_model.SQLColumnModel] – the column names of the query

plasoscaffolder.dal.sqlite_database_information module

Information for the SQLite Database.

class plasoscaffolder.dal.sqlite_database_information.SQLiteDatabaseInformation(sql_execution: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution)[source]

Bases: plasoscaffolder.dal.base_database_information.BaseDatabaseInformation

Class representing the SQLite Query validator.

GetTableColumnsAndType(table: str, all_lowercase: bool = False) → [<class 'str'>][source]

Returns the table information from the database

Parameters:
  • table (str) – the name of the table
  • all_lowercase (bool) – if the table name and the type should be returned in lower case
Returns:

the table information, with the name of the column and the

type of the column

Return type:

{name, type}

GetTablesFromDatabase() → [<class 'str'>][source]

Returns all tables from the database

Returns:the names of the tables
Return type:[str]

plasoscaffolder.dal.sqlite_query_execution module

SQLite Query Execution

class plasoscaffolder.dal.sqlite_query_execution.SQLiteQueryExecution(database_path: str)[source]

Bases: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution

Class representing the SQLite Query validator.

ExecuteQuery(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteQueryDetailed(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query and gets detailed information.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteReadOnlyQuery(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query if it is read only, and valid to parse.

Parameters:query (str) – the SQL Query to execute on the SQLite database
Returns:the data to the Query
Return type:sql_query_data.SQLQueryData
TryToConnect() → bool[source]

Try to open the database File.

Returns:if the file can be opened and is a database file
Return type:bool

plasoscaffolder.dal.sqlite_type_helper module

SQLite Type Helper.

class plasoscaffolder.dal.sqlite_type_helper.SQLiteTypeHelper(execution: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution, explain: plasoscaffolder.dal.base_explain_query_plan.BaseExplainQueryPlan, database_information: plasoscaffolder.dal.base_database_information.BaseDatabaseInformation)[source]

Bases: plasoscaffolder.dal.base_type_helper.BaseTypeHelper

Class representing the type helper for SQLite.

AddMissingTypesFromSchema(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>], query: str) → [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>][source]

Getting Information for the column out of the cursor.

Parameters:
Returns:

a list with all the columns

Return type:

[sql_query_column_model.SQLColumnModel]

GetColumnInformationFromDescription(descriptions: []) → [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>][source]

Getting Information for the column out of the cursor.

Parameters:descriptions – the descriptions of the cursor
Returns:
a list with all the column
names, the types are None
Return type:[sql_query_column_model.SQLColumnModel]
GetDuplicateColumnNames(columns: plasoscaffolder.model.sql_query_column_model.SQLColumnModel) → [<class 'str'>][source]
Find out if the query has duplicate column names and if a alias is
needed.
Parameters:columns (sql_query_column_model.SQLColumnModel) – all columns parsed from the cursor
Returns:
a list of all the duplicate column names, if its empty it means it
is a distinct list of columns
Return type:[str]

Module contents