ormlambda 3.34.0__tar.gz → 3.34.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ormlambda-3.34.0 → ormlambda-3.34.5}/PKG-INFO +2 -3
- {ormlambda-3.34.0 → ormlambda-3.34.5}/pyproject.toml +1 -1
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/__init__.py +33 -0
- ormlambda-3.34.5/src/ormlambda/databases/__init__.py +4 -0
- ormlambda-3.34.5/src/ormlambda/databases/my_sql/__init__.py +3 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/caster.py +5 -1
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/__init__.py +2 -0
- ormlambda-3.34.5/src/ormlambda/databases/my_sql/caster/types/date.py +34 -0
- ormlambda-3.34.5/src/ormlambda/databases/my_sql/caster/types/decimal.py +32 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/__init__.py +1 -0
- ormlambda-3.34.5/src/ormlambda/databases/my_sql/clauses/drop_table.py +26 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql/repository → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/repository.py +5 -0
- ormlambda-3.34.5/src/ormlambda/dialects/mysql/__init__.py +8 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/base.py +194 -129
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/types.py +4 -1
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/engine/base.py +4 -23
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/IRepositoryBase.py +7 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/clause_info.py +13 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/column/column.py +26 -7
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/compiler.py +2 -243
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/ddl.py +4 -18
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/foreign_key.py +0 -18
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/sqltypes.py +12 -6
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/table/table.py +9 -5
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/type_api.py +3 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/visitors.py +3 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/interfaces/IStatements.py +0 -3
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/statements.py +1 -7
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/__init__.py +2 -1
- ormlambda-3.34.5/src/ormlambda/util/load_module.py +21 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/dynamic_module.py +1 -1
- ormlambda-3.34.0/src/ormlambda/dialects/mysql/__init__.py +0 -38
- ormlambda-3.34.0/src/ormlambda/dialects/mysql/repository/__init__.py +0 -1
- {ormlambda-3.34.0 → ormlambda-3.34.5}/AUTHORS +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/LICENSE +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/README.md +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/caster/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/caster/base_caster.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/caster/caster.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/caster/interfaces/ICaster.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/caster/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/clause_info_converter.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/decomposition_query.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/enums/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/enums/condition_types.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/enums/join_type.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/errors/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/global_checker.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/ICustomAlias.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IDecompositionQuery.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IJoinSelector.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/__init__.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/boolean.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/bytes.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/datetime.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/float.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/int.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/iterable.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/none.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/point.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/caster/types/string.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/ST_AsText.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/ST_Contains.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/count.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/delete.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/group_by.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/having.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/insert.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/joins.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/limit.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/offset.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/order.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/update.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/upsert.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/clauses/where.py +0 -0
- {ormlambda-3.34.0/src/ormlambda/dialects/mysql/repository → ormlambda-3.34.5/src/ormlambda/databases/my_sql}/pool_types.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/default/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/default/base.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/interface/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/interface/dialect.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/mysqlconnector.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/base.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/pysqlite.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/engine/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/engine/create.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/engine/url.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/engine/utils.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/env.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/errors.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/model/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/model/base_model.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/base_repository.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/IDatabaseConnection.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/repository/response.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/aggregate_function_base.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/clause_info_context.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/IAggregate.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/IClauseInfo.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/alias.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/count.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/delete.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/group_by.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/having.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/insert.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IDelete.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IInsert.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/ISelect.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IUpdate.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IUpsert.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/join/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/join/join_context.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/joins.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/limit.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/offset.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/order.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/select.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/update.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/upsert.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/where.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/column/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/comparer.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/elements.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/functions/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/functions/concat.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/functions/max.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/functions/min.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/functions/sum.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/table/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/table/fields.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/table/table_constructor.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/sql/types.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/base_statement.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/interfaces/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/query_builder.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/statements/types.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/types/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/types/metadata.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/__init__.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/dfs_traversal.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/plugin_loader.py +0 -0
- {ormlambda-3.34.0 → ormlambda-3.34.5}/src/ormlambda/util/typing.py +0 -0
@@ -1,13 +1,12 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: ormlambda
|
3
|
-
Version: 3.34.
|
3
|
+
Version: 3.34.5
|
4
4
|
Summary: ORM designed to interact with the database (currently with MySQL) using lambda functions and nested functions
|
5
5
|
Author: p-hzamora
|
6
6
|
Author-email: p.hzamora@icloud.com
|
7
7
|
Requires-Python: >=3.12,<4.0
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
10
|
-
Classifier: Programming Language :: Python :: 3.13
|
11
10
|
Requires-Dist: mysql-connector-python (>=9.0.0,<10.0.0)
|
12
11
|
Requires-Dist: shapely (>=2.0.6,<3.0.0)
|
13
12
|
Description-Content-Type: text/markdown
|
@@ -3,7 +3,7 @@ line-length = 320
|
|
3
3
|
|
4
4
|
[tool.poetry]
|
5
5
|
name = "ormlambda"
|
6
|
-
version = "3.34.
|
6
|
+
version = "3.34.5"
|
7
7
|
description = "ORM designed to interact with the database (currently with MySQL) using lambda functions and nested functions"
|
8
8
|
authors = ["p-hzamora <p.hzamora@icloud.com>"]
|
9
9
|
readme = "README.md"
|
@@ -24,3 +24,36 @@ from .model.base_model import (
|
|
24
24
|
) # COMMENT: to avoid relative import we need to import BaseModel after import Table,Column, ForeignKey, IRepositoryBase and Disassembler
|
25
25
|
|
26
26
|
from .engine import create_engine, URL, make_url # noqa: F401
|
27
|
+
|
28
|
+
from .sql.sqltypes import ( # noqa: F401
|
29
|
+
JSON as JSON,
|
30
|
+
UUID as UUID,
|
31
|
+
NullType as NullType,
|
32
|
+
INTEGER as INTEGER,
|
33
|
+
INT as INT,
|
34
|
+
SMALLINTEGER as SMALLINTEGER,
|
35
|
+
BIGINTEGER as BIGINTEGER,
|
36
|
+
NUMERIC as NUMERIC,
|
37
|
+
FLOAT as FLOAT,
|
38
|
+
REAL as REAL,
|
39
|
+
DOUBLE as DOUBLE,
|
40
|
+
DECIMAL as DECIMAL,
|
41
|
+
STRING as STRING,
|
42
|
+
TEXT as TEXT,
|
43
|
+
UNICODE as UNICODE,
|
44
|
+
UNICODETEXT as UNICODETEXT,
|
45
|
+
CHAR as CHAR,
|
46
|
+
NCHAR as NCHAR,
|
47
|
+
BLOB as BLOB,
|
48
|
+
VARCHAR as VARCHAR,
|
49
|
+
NVARCHAR as NVARCHAR,
|
50
|
+
DATE as DATE,
|
51
|
+
TIME as TIME,
|
52
|
+
DATETIME as DATETIME,
|
53
|
+
TIMESTAMP as TIMESTAMP,
|
54
|
+
BOOLEAN as BOOLEAN,
|
55
|
+
LARGEBINARY as LARGEBINARY,
|
56
|
+
VARBINARY as VARBINARY,
|
57
|
+
ENUM as ENUM,
|
58
|
+
POINT as POINT,
|
59
|
+
)
|
@@ -12,11 +12,13 @@ from .types import (
|
|
12
12
|
BytesCaster,
|
13
13
|
IterableCaster,
|
14
14
|
BooleanCaster,
|
15
|
+
DecimalCaster,
|
15
16
|
)
|
16
17
|
|
17
18
|
from shapely import Point
|
18
19
|
from types import NoneType
|
19
|
-
from datetime import datetime
|
20
|
+
from datetime import datetime, date
|
21
|
+
from decimal import Decimal
|
20
22
|
|
21
23
|
|
22
24
|
class MySQLCaster(Caster):
|
@@ -31,9 +33,11 @@ class MySQLCaster(Caster):
|
|
31
33
|
Point: PointCaster,
|
32
34
|
NoneType: NoneTypeCaster,
|
33
35
|
datetime: DatetimeCaster,
|
36
|
+
date: DatetimeCaster,
|
34
37
|
bytes: BytesCaster,
|
35
38
|
bytearray: BytesCaster,
|
36
39
|
tuple: IterableCaster,
|
37
40
|
list: IterableCaster,
|
38
41
|
bool: BooleanCaster,
|
42
|
+
Decimal: DecimalCaster,
|
39
43
|
}
|
@@ -7,3 +7,5 @@ from .datetime import DatetimeCaster as DatetimeCaster
|
|
7
7
|
from .bytes import BytesCaster as BytesCaster
|
8
8
|
from .iterable import IterableCaster as IterableCaster
|
9
9
|
from .boolean import BooleanCaster as BooleanCaster
|
10
|
+
from .date import DateCaster as DateCaster
|
11
|
+
from .decimal import DecimalCaster as DecimalCaster
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from ormlambda.caster import BaseCaster, Caster
|
3
|
+
from datetime import datetime
|
4
|
+
from .string import StringCaster
|
5
|
+
|
6
|
+
|
7
|
+
class DateCaster[TType](BaseCaster[datetime, TType]):
|
8
|
+
def __init__(self, value: datetime, type_value: TType):
|
9
|
+
super().__init__(value, type_value)
|
10
|
+
|
11
|
+
def wildcard_to_select(self, value: Optional[str] = None) -> str:
|
12
|
+
return Caster.PLACEHOLDER if value is None else value
|
13
|
+
|
14
|
+
def wildcard_to_where(self, value: Optional[str] = None) -> str:
|
15
|
+
return Caster.PLACEHOLDER if value is None else value
|
16
|
+
|
17
|
+
def wildcard_to_insert(self, value: Optional[str] = None) -> str:
|
18
|
+
return Caster.PLACEHOLDER if value is None else value
|
19
|
+
|
20
|
+
@property
|
21
|
+
@BaseCaster.return_value_if_exists
|
22
|
+
def to_database(self) -> Optional[datetime]:
|
23
|
+
return self.value
|
24
|
+
|
25
|
+
@property
|
26
|
+
@BaseCaster.return_value_if_exists
|
27
|
+
def from_database(self) -> Optional[datetime]:
|
28
|
+
return self.value
|
29
|
+
|
30
|
+
@property
|
31
|
+
@BaseCaster.return_value_if_exists
|
32
|
+
def string_data(self) -> Optional[str]:
|
33
|
+
datetime_string = self.value.strftime(r"%Y-%m-%d")
|
34
|
+
return StringCaster(datetime_string, str).string_data
|
@@ -0,0 +1,32 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
from ormlambda.caster import BaseCaster, Caster
|
3
|
+
from decimal import Decimal
|
4
|
+
|
5
|
+
|
6
|
+
class DecimalCaster[TType](BaseCaster[Decimal, TType]):
|
7
|
+
def __init__(self, value: Decimal, type_value: TType):
|
8
|
+
super().__init__(value, type_value)
|
9
|
+
|
10
|
+
def wildcard_to_select(self, value: Optional[str] = None) -> str:
|
11
|
+
return Caster.PLACEHOLDER if value is None else value
|
12
|
+
|
13
|
+
def wildcard_to_where(self, value: Optional[str] = None) -> str:
|
14
|
+
return Caster.PLACEHOLDER if value is None else value
|
15
|
+
|
16
|
+
def wildcard_to_insert(self, value: Optional[str] = None) -> str:
|
17
|
+
return Caster.PLACEHOLDER if value is None else value
|
18
|
+
|
19
|
+
@property
|
20
|
+
@BaseCaster.return_value_if_exists
|
21
|
+
def to_database(self) -> Optional[Decimal]:
|
22
|
+
return Decimal(self.value)
|
23
|
+
|
24
|
+
@property
|
25
|
+
@BaseCaster.return_value_if_exists
|
26
|
+
def from_database(self) -> Optional[Decimal]:
|
27
|
+
return Decimal(self.value)
|
28
|
+
|
29
|
+
@property
|
30
|
+
@BaseCaster.return_value_if_exists
|
31
|
+
def string_data(self) -> Optional[str]:
|
32
|
+
return str(self.value)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
from typing import Literal, override, TYPE_CHECKING
|
3
|
+
|
4
|
+
if TYPE_CHECKING:
|
5
|
+
from mysql.connector import MySQLConnection
|
6
|
+
|
7
|
+
from ormlambda.repository import BaseRepository
|
8
|
+
|
9
|
+
|
10
|
+
TypeExists = Literal["fail", "replace", "append"]
|
11
|
+
|
12
|
+
|
13
|
+
class DropTable:
|
14
|
+
def __init__(self, repository: BaseRepository[MySQLConnection]) -> None:
|
15
|
+
self._repository: BaseRepository[MySQLConnection] = repository
|
16
|
+
|
17
|
+
@override
|
18
|
+
def execute(self, name: str = None) -> None:
|
19
|
+
query = rf"{self.CLAUSE} {name}"
|
20
|
+
self._repository.execute(query)
|
21
|
+
return None
|
22
|
+
|
23
|
+
@property
|
24
|
+
@override
|
25
|
+
def CLAUSE(self) -> str:
|
26
|
+
return "DROP TABLE"
|
@@ -10,6 +10,7 @@ from mysql.connector.pooling import MySQLConnectionPool # noqa: F401
|
|
10
10
|
from ormlambda.repository import BaseRepository
|
11
11
|
|
12
12
|
# Custom libraries
|
13
|
+
from .clauses import DropTable
|
13
14
|
from ormlambda.repository.response import Response
|
14
15
|
from ormlambda.caster import Caster
|
15
16
|
|
@@ -166,6 +167,10 @@ class MySQLRepository(BaseRepository[MySQLConnectionPool]):
|
|
166
167
|
cursor.execute(query)
|
167
168
|
return None
|
168
169
|
|
170
|
+
@override
|
171
|
+
def drop_table(self, name: str) -> None:
|
172
|
+
return DropTable(self).execute(name)
|
173
|
+
|
169
174
|
@override
|
170
175
|
def database_exists(self, name: str) -> bool:
|
171
176
|
temp_config = self._pool._cnx_config
|
@@ -10,7 +10,10 @@ if TYPE_CHECKING:
|
|
10
10
|
|
11
11
|
from .types import (
|
12
12
|
_NumericType,
|
13
|
+
_NumericCommonType,
|
13
14
|
_StringType,
|
15
|
+
VARCHAR,
|
16
|
+
CHAR,
|
14
17
|
NUMERIC,
|
15
18
|
DECIMAL,
|
16
19
|
DOUBLE,
|
@@ -36,10 +39,17 @@ from .types import (
|
|
36
39
|
MEDIUMBLOB,
|
37
40
|
LONGBLOB,
|
38
41
|
)
|
39
|
-
from ormlambda.sql.sqltypes import
|
42
|
+
from ormlambda.sql.sqltypes import (
|
43
|
+
LARGEBINARY,
|
44
|
+
BLOB,
|
45
|
+
BOOLEAN,
|
46
|
+
DATE,
|
47
|
+
UUID,
|
48
|
+
VARBINARY,
|
49
|
+
)
|
50
|
+
|
40
51
|
|
41
|
-
from .
|
42
|
-
from .repository import MySQLRepository
|
52
|
+
from ormlambda.databases.my_sql import MySQLRepository, MySQLCaster
|
43
53
|
|
44
54
|
|
45
55
|
if TYPE_CHECKING:
|
@@ -74,7 +84,7 @@ class MySQLCompiler(compiler.SQLCompiler):
|
|
74
84
|
"""Overridden from base SQLCompiler value"""
|
75
85
|
|
76
86
|
def visit_select(self, select: Select, **kw):
|
77
|
-
return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect
|
87
|
+
return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect, **kw)}"
|
78
88
|
|
79
89
|
def visit_group_by(self, groupby: GroupBy, **kw):
|
80
90
|
column = groupby._create_query(self.dialect, **kw)
|
@@ -111,7 +121,7 @@ class MySQLCompiler(compiler.SQLCompiler):
|
|
111
121
|
context = ClauseInfoContext(table_context=order._context._table_context, clause_context=None) if order._context else None
|
112
122
|
for index, clause in enumerate(order._convert_into_clauseInfo(columns, context, dialect=self.dialect)):
|
113
123
|
clause.alias_clause = None
|
114
|
-
string_columns.append(f"{clause.query(self.dialect
|
124
|
+
string_columns.append(f"{clause.query(self.dialect, **kw)} {str(order._order_type[index])}")
|
115
125
|
|
116
126
|
return f"{order.FUNCTION_NAME()} {', '.join(string_columns)}"
|
117
127
|
|
@@ -123,7 +133,7 @@ class MySQLCompiler(compiler.SQLCompiler):
|
|
123
133
|
|
124
134
|
class MySQLDDLCompiler(compiler.DDLCompiler):
|
125
135
|
def get_column_specification(self, column: Column, **kwargs):
|
126
|
-
colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.
|
136
|
+
colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.dbtype)
|
127
137
|
default = self.get_column_default_string(column)
|
128
138
|
if default is not None:
|
129
139
|
colspec += " DEFAULT " + default
|
@@ -165,7 +175,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
|
|
165
175
|
return getattr(type_, name, defaults.get(name))
|
166
176
|
|
167
177
|
if attr("charset"):
|
168
|
-
charset = f"CHARACTER SET {attr(
|
178
|
+
charset = f"CHARACTER SET {attr('charset')}"
|
169
179
|
elif attr("ascii"):
|
170
180
|
charset = "ASCII"
|
171
181
|
elif attr("unicode"):
|
@@ -185,183 +195,238 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
|
|
185
195
|
return " ".join([c for c in ("NATIONAL", spec, collation) if c is not None])
|
186
196
|
return " ".join([c for c in (spec, charset, collation) if c is not None])
|
187
197
|
|
188
|
-
def
|
189
|
-
|
198
|
+
def _mysql_type(self, type_, **kw):
|
199
|
+
return isinstance(type, _StringType | _NumericCommonType)
|
200
|
+
|
201
|
+
def visit_NUMERIC(self, type_: NUMERIC, **kw):
|
202
|
+
if type_.precision is None:
|
203
|
+
return self._extend_numeric(type_, "NUMERIC")
|
204
|
+
elif type_.scale is None:
|
190
205
|
return self._extend_numeric(
|
191
206
|
type_,
|
192
|
-
f"
|
207
|
+
f"NUMERIC({type_.precision})",
|
193
208
|
)
|
194
209
|
else:
|
195
|
-
return self._extend_numeric(
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
raise ValueError("VARCHAR requires a length on dialect %s" % self.dialect.name)
|
200
|
-
return self._extend_string(type_, {}, "VARCHAR(%d)" % type_.length)
|
201
|
-
|
202
|
-
def visit_CHAR(self, type_, **kw):
|
203
|
-
if type_.length is not None:
|
204
|
-
return self._extend_string(type_, {}, "CHAR(%(length)s)" % {"length": type_.length})
|
205
|
-
else:
|
206
|
-
return self._extend_string(type_, {}, "CHAR")
|
207
|
-
|
208
|
-
def visit_NUMERIC(self, type_: NUMERIC, **kw):
|
209
|
-
return "NUMERIC"
|
210
|
+
return self._extend_numeric(
|
211
|
+
type_,
|
212
|
+
f"NUMERIC({type_.precision}, {type_.scale})",
|
213
|
+
)
|
210
214
|
|
211
215
|
def visit_DECIMAL(self, type_: DECIMAL, **kw):
|
212
|
-
|
216
|
+
if type_.precision is None:
|
217
|
+
return self._extend_numeric(type_, "DECIMAL")
|
218
|
+
elif type_.scale is None:
|
219
|
+
return self._extend_numeric(
|
220
|
+
type_,
|
221
|
+
f"DECIMAL({type_.precision})",
|
222
|
+
)
|
223
|
+
else:
|
224
|
+
return self._extend_numeric(
|
225
|
+
type_,
|
226
|
+
f"DECIMAL({type_.precision}, {type_.scale})",
|
227
|
+
)
|
213
228
|
|
214
229
|
def visit_DOUBLE(self, type_: DOUBLE, **kw):
|
215
|
-
|
230
|
+
if type_.precision is not None and type_.scale is not None:
|
231
|
+
return self._extend_numeric(
|
232
|
+
type_,
|
233
|
+
f"DOUBLE({type_.precision}, {type_.scale})",
|
234
|
+
)
|
235
|
+
else:
|
236
|
+
return self._extend_numeric(type_, "DOUBLE")
|
216
237
|
|
217
238
|
def visit_REAL(self, type_: REAL, **kw):
|
218
|
-
|
239
|
+
if type_.precision is not None and type_.scale is not None:
|
240
|
+
return self._extend_numeric(
|
241
|
+
type_,
|
242
|
+
f"REAL({type_.precision}, {type_.scale})",
|
243
|
+
)
|
244
|
+
else:
|
245
|
+
return self._extend_numeric(type_, "REAL")
|
219
246
|
|
220
247
|
def visit_FLOAT(self, type_: FLOAT, **kw):
|
221
|
-
|
248
|
+
if self._mysql_type(type_) and type_.scale is not None and type_.precision is not None:
|
249
|
+
return self._extend_numeric(type_, f"FLOAT({type_.precision}, {type_.scale})")
|
250
|
+
elif type_.precision is not None:
|
251
|
+
return self._extend_numeric(type_, f"FLOAT({type_.precision})")
|
252
|
+
else:
|
253
|
+
return self._extend_numeric(type_, "FLOAT")
|
254
|
+
|
255
|
+
def visit_INTEGER(self, type_: INTEGER, **kw):
|
256
|
+
if self._mysql_type(type_) and type_.display_width is not None:
|
257
|
+
return self._extend_numeric(
|
258
|
+
type_,
|
259
|
+
f"INTEGER({type_.display_width})",
|
260
|
+
)
|
261
|
+
else:
|
262
|
+
return self._extend_numeric(type_, "INTEGER")
|
222
263
|
|
223
264
|
def visit_BIGINT(self, type_: BIGINT, **kw):
|
224
|
-
|
265
|
+
if self._mysql_type(type_) and type_.display_width is not None:
|
266
|
+
return self._extend_numeric(
|
267
|
+
type_,
|
268
|
+
f"BIGINT({type_.display_width})",
|
269
|
+
)
|
270
|
+
else:
|
271
|
+
return self._extend_numeric(type_, "BIGINT")
|
225
272
|
|
226
273
|
def visit_MEDIUMINT(self, type_: MEDIUMINT, **kw):
|
227
|
-
|
274
|
+
if self._mysql_type(type_) and type_.display_width is not None:
|
275
|
+
return self._extend_numeric(
|
276
|
+
type_,
|
277
|
+
f"MEDIUMINT({type_.display_width})",
|
278
|
+
)
|
279
|
+
else:
|
280
|
+
return self._extend_numeric(type_, "MEDIUMINT")
|
228
281
|
|
229
282
|
def visit_TINYINT(self, type_: TINYINT, **kw):
|
230
|
-
|
283
|
+
if self._mysql_type(type_) and type_.display_width is not None:
|
284
|
+
return self._extend_numeric(type_, f"TINYINT({type_.display_width})")
|
285
|
+
else:
|
286
|
+
return self._extend_numeric(type_, "TINYINT")
|
231
287
|
|
232
288
|
def visit_SMALLINT(self, type_: SMALLINT, **kw):
|
233
|
-
|
289
|
+
if self._mysql_type(type_) and type_.display_width is not None:
|
290
|
+
return self._extend_numeric(
|
291
|
+
type_,
|
292
|
+
f"SMALLINT({type_.display_width})",
|
293
|
+
)
|
294
|
+
else:
|
295
|
+
return self._extend_numeric(type_, "SMALLINT")
|
234
296
|
|
235
297
|
def visit_BIT(self, type_: BIT, **kw):
|
236
|
-
|
298
|
+
if type_.length is not None:
|
299
|
+
return f"BIT({type_.length})"
|
300
|
+
else:
|
301
|
+
return "BIT"
|
302
|
+
|
303
|
+
def visit_DATETIME(self, type_: DATETIME, **kw):
|
304
|
+
if getattr(type_, "fsp", None):
|
305
|
+
return f"DATETIME({type_.fsp})"
|
306
|
+
else:
|
307
|
+
return "DATETIME"
|
308
|
+
|
309
|
+
def visit_DATE(self, type_: DATE, **kw):
|
310
|
+
return "DATE"
|
237
311
|
|
238
312
|
def visit_TIME(self, type_: TIME, **kw):
|
239
|
-
|
313
|
+
if getattr(type_, "fsp", None):
|
314
|
+
return f"TIME({type_.fsp})"
|
315
|
+
else:
|
316
|
+
return "TIME"
|
240
317
|
|
241
318
|
def visit_TIMESTAMP(self, type_: TIMESTAMP, **kw):
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
319
|
+
if getattr(type_, "fsp", None):
|
320
|
+
return f"TIMESTAMP({type_.fsp})"
|
321
|
+
else:
|
322
|
+
return "TIMESTAMP"
|
246
323
|
|
247
324
|
def visit_YEAR(self, type_: YEAR, **kw):
|
248
|
-
|
325
|
+
if type_.display_width is None:
|
326
|
+
return "YEAR"
|
327
|
+
else:
|
328
|
+
return f"YEAR({type_.display_width})"
|
249
329
|
|
250
330
|
def visit_TEXT(self, type_: TEXT, **kw):
|
251
331
|
if type_.length is not None:
|
252
332
|
return self._extend_string(type_, {}, f"TEXT({type_.length})")
|
253
|
-
|
333
|
+
else:
|
334
|
+
return self._extend_string(type_, {}, "TEXT")
|
254
335
|
|
255
336
|
def visit_TINYTEXT(self, type_: TINYTEXT, **kw):
|
256
|
-
return "TINYTEXT"
|
337
|
+
return self._extend_string(type_, {}, "TINYTEXT")
|
257
338
|
|
258
339
|
def visit_MEDIUMTEXT(self, type_: MEDIUMTEXT, **kw):
|
259
|
-
return "MEDIUMTEXT"
|
340
|
+
return self._extend_string(type_, {}, "MEDIUMTEXT")
|
260
341
|
|
261
342
|
def visit_LONGTEXT(self, type_: LONGTEXT, **kw):
|
262
|
-
return "LONGTEXT"
|
263
|
-
|
264
|
-
def visit_NVARCHAR(self, type_: NVARCHAR, **kw):
|
265
|
-
return "NVARCHAR"
|
266
|
-
|
267
|
-
def visit_NCHAR(self, type_: NCHAR, **kw):
|
268
|
-
return "NCHAR"
|
269
|
-
|
270
|
-
def visit_TINYBLOB(self, type_: TINYBLOB, **kw):
|
271
|
-
return "TINYBLOB"
|
272
|
-
|
273
|
-
def visit_BLOB(self, type_: BLOB, **kw) -> str:
|
274
|
-
blob = "BLOB"
|
275
|
-
blob += f"({type_.length})" if type_.length is not None else ""
|
276
|
-
return blob
|
277
|
-
|
278
|
-
def visit_MEDIUMBLOB(self, type_: MEDIUMBLOB, **kw):
|
279
|
-
return "MEDIUMBLOB"
|
280
|
-
|
281
|
-
def visit_LONGBLOB(self, type_: LONGBLOB, **kw):
|
282
|
-
return "LONGBLOB"
|
283
|
-
|
284
|
-
# region visit lowercase
|
285
|
-
|
286
|
-
def visit_integer(self, type_: INTEGER, **kw):
|
287
|
-
return self.visit_INTEGER(type_, **kw)
|
288
|
-
|
289
|
-
def visit_varchar(self, type_, **kw):
|
290
|
-
return self.visit_VARCHAR(type_, **kw)
|
291
|
-
|
292
|
-
def visit_char(self, type_, **kw):
|
293
|
-
return self.visit_CHAR(type_, **kw)
|
294
|
-
|
295
|
-
def visit_numeric(self, type_: NUMERIC, **kw):
|
296
|
-
return self.visit_NUMERIC(type_, **kw)
|
297
|
-
|
298
|
-
def visit_decimal(self, type_: DECIMAL, **kw):
|
299
|
-
return self.visit_DECIMAL(type_, **kw)
|
300
|
-
|
301
|
-
def visit_double(self, type_: DOUBLE, **kw):
|
302
|
-
return self.visit_DOUBLE(type_, **kw)
|
343
|
+
return self._extend_string(type_, {}, "LONGTEXT")
|
303
344
|
|
304
|
-
def
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
def visit_bigint(self, type_: BIGINT, **kw):
|
311
|
-
return self.visit_BIGINT(type_, **kw)
|
312
|
-
|
313
|
-
def visit_mediumint(self, type_: MEDIUMINT, **kw):
|
314
|
-
return self.visit_MEDIUMINT(type_, **kw)
|
315
|
-
|
316
|
-
def visit_tinyint(self, type_: TINYINT, **kw):
|
317
|
-
return self.visit_TINYINT(type_, **kw)
|
345
|
+
def visit_VARCHAR(self, type_: VARCHAR, **kw):
|
346
|
+
if type_.length is not None:
|
347
|
+
return self._extend_string(type_, {}, f"VARCHAR({type_.length})")
|
348
|
+
else:
|
349
|
+
raise ValueError(f"VARCHAR requires a length on dialect {self.dialect.name}")
|
318
350
|
|
319
|
-
def
|
320
|
-
|
351
|
+
def visit_CHAR(self, type_: CHAR, **kw):
|
352
|
+
if type_.length is not None:
|
353
|
+
return self._extend_string(type_, {}, f"CHAR({type_.length})")
|
354
|
+
else:
|
355
|
+
return self._extend_string(type_, {}, "CHAR")
|
321
356
|
|
322
|
-
def
|
323
|
-
|
357
|
+
def visit_NVARCHAR(self, type_: NVARCHAR, **kw):
|
358
|
+
# We'll actually generate the equiv. "NATIONAL VARCHAR" instead
|
359
|
+
# of "NVARCHAR".
|
360
|
+
if type_.length is not None:
|
361
|
+
return self._extend_string(
|
362
|
+
type_,
|
363
|
+
{"national": True},
|
364
|
+
f"VARCHAR({type_.length})",
|
365
|
+
)
|
366
|
+
else:
|
367
|
+
raise ValueError(f"NVARCHAR requires a length on dialect {self.dialect.name}")
|
324
368
|
|
325
|
-
def
|
326
|
-
|
369
|
+
def visit_NCHAR(self, type_: NCHAR, **kw):
|
370
|
+
# We'll actually generate the equiv.
|
371
|
+
# "NATIONAL CHAR" instead of "NCHAR".
|
372
|
+
if type_.length is not None:
|
373
|
+
return self._extend_string(
|
374
|
+
type_,
|
375
|
+
{"national": True},
|
376
|
+
f"CHAR({type_.length})",
|
377
|
+
)
|
378
|
+
else:
|
379
|
+
return self._extend_string(type_, {"national": True}, "CHAR")
|
327
380
|
|
328
|
-
def
|
329
|
-
return
|
381
|
+
def visit_UUID(self, type_: UUID, **kw):
|
382
|
+
return "UUID"
|
330
383
|
|
331
|
-
def
|
332
|
-
return
|
384
|
+
def visit_VARBINARY(self, type_: VARBINARY, **kw):
|
385
|
+
return f"VARBINARY({type_.length})"
|
333
386
|
|
334
|
-
def
|
335
|
-
return
|
387
|
+
def visit_JSON(self, type_, **kw):
|
388
|
+
return "JSON"
|
336
389
|
|
337
|
-
def
|
338
|
-
return self.
|
390
|
+
def visit_large_binary(self, type_: LARGEBINARY, **kw):
|
391
|
+
return self.visit_BLOB(type_)
|
339
392
|
|
340
|
-
def
|
341
|
-
|
393
|
+
def visit_enum(self, type_, **kw):
|
394
|
+
if not type_.native_enum:
|
395
|
+
return super().visit_enum(type_)
|
396
|
+
else:
|
397
|
+
return self.visit_ENUM(type_, type_.enums)
|
342
398
|
|
343
|
-
def
|
344
|
-
|
399
|
+
def visit_BLOB(self, type_: BLOB, **kw):
|
400
|
+
if type_.length is not None:
|
401
|
+
return f"BLOB({type_.length})"
|
402
|
+
else:
|
403
|
+
return "BLOB"
|
345
404
|
|
346
|
-
def
|
347
|
-
return
|
405
|
+
def visit_TINYBLOB(self, type_: TINYBLOB, **kw):
|
406
|
+
return "TINYBLOB"
|
348
407
|
|
349
|
-
def
|
350
|
-
return
|
408
|
+
def visit_MEDIUMBLOB(self, type_: MEDIUMBLOB, **kw):
|
409
|
+
return "MEDIUMBLOB"
|
351
410
|
|
352
|
-
def
|
353
|
-
return
|
411
|
+
def visit_LONGBLOB(self, type_: LONGBLOB, **kw):
|
412
|
+
return "LONGBLOB"
|
354
413
|
|
355
|
-
def
|
356
|
-
|
414
|
+
def _visit_enumerated_values(self, name, type_, enumerated_values):
|
415
|
+
quoted_enums = []
|
416
|
+
for e in enumerated_values:
|
417
|
+
if self.dialect.identifier_preparer._double_percents:
|
418
|
+
e = e.replace("%", "%%")
|
419
|
+
quoted_enums.append(f"'{e.replace("'", "''")}'")
|
420
|
+
return self._extend_string(type_, {}, f"{name}({','.join(quoted_enums)})")
|
357
421
|
|
358
|
-
def
|
359
|
-
return self.
|
422
|
+
def visit_ENUM(self, type_, **kw):
|
423
|
+
return self._visit_enumerated_values("ENUM", type_, type_.enums)
|
360
424
|
|
361
|
-
def
|
362
|
-
return self.
|
425
|
+
def visit_SET(self, type_, **kw):
|
426
|
+
return self._visit_enumerated_values("SET", type_, type_.values)
|
363
427
|
|
364
|
-
|
428
|
+
def visit_BOOLEAN(self, type_: BOOLEAN, **kw):
|
429
|
+
return "BOOL"
|
365
430
|
|
366
431
|
|
367
432
|
class MySQLDialect(default.DefaultDialect):
|