ormlambda 3.34.1__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.
Files changed (157) hide show
  1. {ormlambda-3.34.1 → ormlambda-3.34.5}/PKG-INFO +1 -1
  2. {ormlambda-3.34.1 → ormlambda-3.34.5}/pyproject.toml +1 -1
  3. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/__init__.py +33 -0
  4. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/base.py +193 -127
  5. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/types.py +4 -1
  6. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/clause_info.py +13 -0
  7. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/column/column.py +26 -7
  8. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/sqltypes.py +12 -6
  9. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/type_api.py +3 -0
  10. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/visitors.py +3 -0
  11. {ormlambda-3.34.1 → ormlambda-3.34.5}/AUTHORS +0 -0
  12. {ormlambda-3.34.1 → ormlambda-3.34.5}/LICENSE +0 -0
  13. {ormlambda-3.34.1 → ormlambda-3.34.5}/README.md +0 -0
  14. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/caster/__init__.py +0 -0
  15. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/caster/base_caster.py +0 -0
  16. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/caster/caster.py +0 -0
  17. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/caster/interfaces/ICaster.py +0 -0
  18. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/caster/interfaces/__init__.py +0 -0
  19. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/__init__.py +0 -0
  20. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
  21. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/clause_info_converter.py +0 -0
  22. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/decomposition_query.py +0 -0
  23. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
  24. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
  25. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/enums/__init__.py +0 -0
  26. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/enums/condition_types.py +0 -0
  27. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/enums/join_type.py +0 -0
  28. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/errors/__init__.py +0 -0
  29. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/global_checker.py +0 -0
  30. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/ICustomAlias.py +0 -0
  31. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IDecompositionQuery.py +0 -0
  32. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IJoinSelector.py +0 -0
  33. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
  34. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
  35. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/common/interfaces/__init__.py +0 -0
  36. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/__init__.py +0 -0
  37. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/__init__.py +0 -0
  38. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/__init__.py +0 -0
  39. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/caster.py +0 -0
  40. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/__init__.py +0 -0
  41. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/boolean.py +0 -0
  42. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/bytes.py +0 -0
  43. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/date.py +0 -0
  44. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/datetime.py +0 -0
  45. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/decimal.py +0 -0
  46. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/float.py +0 -0
  47. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/int.py +0 -0
  48. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/iterable.py +0 -0
  49. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/none.py +0 -0
  50. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/point.py +0 -0
  51. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/caster/types/string.py +0 -0
  52. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/ST_AsText.py +0 -0
  53. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/ST_Contains.py +0 -0
  54. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/__init__.py +0 -0
  55. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/count.py +0 -0
  56. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/delete.py +0 -0
  57. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/drop_table.py +0 -0
  58. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/group_by.py +0 -0
  59. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/having.py +0 -0
  60. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/insert.py +0 -0
  61. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/joins.py +0 -0
  62. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/limit.py +0 -0
  63. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/offset.py +0 -0
  64. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/order.py +0 -0
  65. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/update.py +0 -0
  66. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/upsert.py +0 -0
  67. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/clauses/where.py +0 -0
  68. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/pool_types.py +0 -0
  69. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/databases/my_sql/repository.py +0 -0
  70. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/__init__.py +0 -0
  71. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/default/__init__.py +0 -0
  72. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/default/base.py +0 -0
  73. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/interface/__init__.py +0 -0
  74. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/interface/dialect.py +0 -0
  75. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/__init__.py +0 -0
  76. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/mysql/mysqlconnector.py +0 -0
  77. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/__init__.py +0 -0
  78. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/base.py +0 -0
  79. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/dialects/sqlite/pysqlite.py +0 -0
  80. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/engine/__init__.py +0 -0
  81. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/engine/base.py +0 -0
  82. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/engine/create.py +0 -0
  83. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/engine/url.py +0 -0
  84. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/engine/utils.py +0 -0
  85. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/env.py +0 -0
  86. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/errors.py +0 -0
  87. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/model/__init__.py +0 -0
  88. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/model/base_model.py +0 -0
  89. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/__init__.py +0 -0
  90. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/base_repository.py +0 -0
  91. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/IDatabaseConnection.py +0 -0
  92. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/IRepositoryBase.py +0 -0
  93. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/interfaces/__init__.py +0 -0
  94. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/repository/response.py +0 -0
  95. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/__init__.py +0 -0
  96. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/__init__.py +0 -0
  97. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/aggregate_function_base.py +0 -0
  98. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/clause_info_context.py +0 -0
  99. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/IAggregate.py +0 -0
  100. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/IClauseInfo.py +0 -0
  101. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clause_info/interface/__init__.py +0 -0
  102. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/__init__.py +0 -0
  103. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/alias.py +0 -0
  104. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/count.py +0 -0
  105. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/delete.py +0 -0
  106. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/group_by.py +0 -0
  107. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/having.py +0 -0
  108. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/insert.py +0 -0
  109. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IDelete.py +0 -0
  110. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IInsert.py +0 -0
  111. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/ISelect.py +0 -0
  112. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IUpdate.py +0 -0
  113. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/IUpsert.py +0 -0
  114. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/interfaces/__init__.py +0 -0
  115. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/join/__init__.py +0 -0
  116. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/join/join_context.py +0 -0
  117. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/joins.py +0 -0
  118. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/limit.py +0 -0
  119. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/offset.py +0 -0
  120. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/order.py +0 -0
  121. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/select.py +0 -0
  122. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/update.py +0 -0
  123. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/upsert.py +0 -0
  124. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/clauses/where.py +0 -0
  125. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/column/__init__.py +0 -0
  126. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/comparer.py +0 -0
  127. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/compiler.py +0 -0
  128. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/ddl.py +0 -0
  129. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/elements.py +0 -0
  130. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/foreign_key.py +0 -0
  131. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/functions/__init__.py +0 -0
  132. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/functions/concat.py +0 -0
  133. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/functions/max.py +0 -0
  134. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/functions/min.py +0 -0
  135. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/functions/sum.py +0 -0
  136. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/interfaces/__init__.py +0 -0
  137. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/table/__init__.py +0 -0
  138. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/table/fields.py +0 -0
  139. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/table/table.py +0 -0
  140. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/table/table_constructor.py +0 -0
  141. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/sql/types.py +0 -0
  142. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/__init__.py +0 -0
  143. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/base_statement.py +0 -0
  144. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/interfaces/IStatements.py +0 -0
  145. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/interfaces/__init__.py +0 -0
  146. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/query_builder.py +0 -0
  147. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/statements.py +0 -0
  148. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/statements/types.py +0 -0
  149. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/types/__init__.py +0 -0
  150. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/types/metadata.py +0 -0
  151. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/__init__.py +0 -0
  152. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/load_module.py +0 -0
  153. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/__init__.py +0 -0
  154. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/dfs_traversal.py +0 -0
  155. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/module_tree/dynamic_module.py +0 -0
  156. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/plugin_loader.py +0 -0
  157. {ormlambda-3.34.1 → ormlambda-3.34.5}/src/ormlambda/util/typing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ormlambda
3
- Version: 3.34.1
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
@@ -3,7 +3,7 @@ line-length = 320
3
3
 
4
4
  [tool.poetry]
5
5
  name = "ormlambda"
6
- version = "3.34.1"
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
+ )
@@ -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,7 +39,15 @@ from .types import (
36
39
  MEDIUMBLOB,
37
40
  LONGBLOB,
38
41
  )
39
- from ormlambda.sql.sqltypes import BLOB
42
+ from ormlambda.sql.sqltypes import (
43
+ LARGEBINARY,
44
+ BLOB,
45
+ BOOLEAN,
46
+ DATE,
47
+ UUID,
48
+ VARBINARY,
49
+ )
50
+
40
51
 
41
52
  from ormlambda.databases.my_sql import MySQLRepository, MySQLCaster
42
53
 
@@ -73,7 +84,7 @@ class MySQLCompiler(compiler.SQLCompiler):
73
84
  """Overridden from base SQLCompiler value"""
74
85
 
75
86
  def visit_select(self, select: Select, **kw):
76
- return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect,**kw)}"
87
+ return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect, **kw)}"
77
88
 
78
89
  def visit_group_by(self, groupby: GroupBy, **kw):
79
90
  column = groupby._create_query(self.dialect, **kw)
@@ -110,7 +121,7 @@ class MySQLCompiler(compiler.SQLCompiler):
110
121
  context = ClauseInfoContext(table_context=order._context._table_context, clause_context=None) if order._context else None
111
122
  for index, clause in enumerate(order._convert_into_clauseInfo(columns, context, dialect=self.dialect)):
112
123
  clause.alias_clause = None
113
- string_columns.append(f"{clause.query(self.dialect,**kw)} {str(order._order_type[index])}")
124
+ string_columns.append(f"{clause.query(self.dialect, **kw)} {str(order._order_type[index])}")
114
125
 
115
126
  return f"{order.FUNCTION_NAME()} {', '.join(string_columns)}"
116
127
 
@@ -122,7 +133,7 @@ class MySQLCompiler(compiler.SQLCompiler):
122
133
 
123
134
  class MySQLDDLCompiler(compiler.DDLCompiler):
124
135
  def get_column_specification(self, column: Column, **kwargs):
125
- colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.dtype)
136
+ colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.dbtype)
126
137
  default = self.get_column_default_string(column)
127
138
  if default is not None:
128
139
  colspec += " DEFAULT " + default
@@ -164,7 +175,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
164
175
  return getattr(type_, name, defaults.get(name))
165
176
 
166
177
  if attr("charset"):
167
- charset = f"CHARACTER SET {attr("charset")}"
178
+ charset = f"CHARACTER SET {attr('charset')}"
168
179
  elif attr("ascii"):
169
180
  charset = "ASCII"
170
181
  elif attr("unicode"):
@@ -184,183 +195,238 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
184
195
  return " ".join([c for c in ("NATIONAL", spec, collation) if c is not None])
185
196
  return " ".join([c for c in (spec, charset, collation) if c is not None])
186
197
 
187
- def visit_INTEGER(self, type_: INTEGER, **kw):
188
- if self.mysql_type(type_) and type_.display_width is not None:
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:
189
205
  return self._extend_numeric(
190
206
  type_,
191
- f"INTEGER(%({type_.display_width})s)",
207
+ f"NUMERIC({type_.precision})",
192
208
  )
193
209
  else:
194
- return self._extend_numeric(type_, "INTEGER")
195
-
196
- def visit_VARCHAR(self, type_, **kw):
197
- if type_.length is None:
198
- raise ValueError("VARCHAR requires a length on dialect %s" % self.dialect.name)
199
- return self._extend_string(type_, {}, "VARCHAR(%d)" % type_.length)
200
-
201
- def visit_CHAR(self, type_, **kw):
202
- if type_.length is not None:
203
- return self._extend_string(type_, {}, "CHAR(%(length)s)" % {"length": type_.length})
204
- else:
205
- return self._extend_string(type_, {}, "CHAR")
206
-
207
- def visit_NUMERIC(self, type_: NUMERIC, **kw):
208
- return "NUMERIC"
210
+ return self._extend_numeric(
211
+ type_,
212
+ f"NUMERIC({type_.precision}, {type_.scale})",
213
+ )
209
214
 
210
215
  def visit_DECIMAL(self, type_: DECIMAL, **kw):
211
- return "DECIMAL"
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
+ )
212
228
 
213
229
  def visit_DOUBLE(self, type_: DOUBLE, **kw):
214
- return "DOUBLE"
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")
215
237
 
216
238
  def visit_REAL(self, type_: REAL, **kw):
217
- return "REAL"
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")
218
246
 
219
247
  def visit_FLOAT(self, type_: FLOAT, **kw):
220
- return "FLOAT"
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")
221
263
 
222
264
  def visit_BIGINT(self, type_: BIGINT, **kw):
223
- return "BIGINT"
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")
224
272
 
225
273
  def visit_MEDIUMINT(self, type_: MEDIUMINT, **kw):
226
- return "MEDIUMINT"
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")
227
281
 
228
282
  def visit_TINYINT(self, type_: TINYINT, **kw):
229
- return "TINYINT"
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")
230
287
 
231
288
  def visit_SMALLINT(self, type_: SMALLINT, **kw):
232
- return "SMALLINT"
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")
233
296
 
234
297
  def visit_BIT(self, type_: BIT, **kw):
235
- return "BIT"
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"
236
311
 
237
312
  def visit_TIME(self, type_: TIME, **kw):
238
- return "TIME"
313
+ if getattr(type_, "fsp", None):
314
+ return f"TIME({type_.fsp})"
315
+ else:
316
+ return "TIME"
239
317
 
240
318
  def visit_TIMESTAMP(self, type_: TIMESTAMP, **kw):
241
- return "TIMESTAMP"
242
-
243
- def visit_DATETIME(self, type_: DATETIME, **kw):
244
- return "DATETIME"
319
+ if getattr(type_, "fsp", None):
320
+ return f"TIMESTAMP({type_.fsp})"
321
+ else:
322
+ return "TIMESTAMP"
245
323
 
246
324
  def visit_YEAR(self, type_: YEAR, **kw):
247
- return "YEAR"
325
+ if type_.display_width is None:
326
+ return "YEAR"
327
+ else:
328
+ return f"YEAR({type_.display_width})"
248
329
 
249
330
  def visit_TEXT(self, type_: TEXT, **kw):
250
331
  if type_.length is not None:
251
332
  return self._extend_string(type_, {}, f"TEXT({type_.length})")
252
- return self._extend_string(type_, {}, "TEXT")
333
+ else:
334
+ return self._extend_string(type_, {}, "TEXT")
253
335
 
254
336
  def visit_TINYTEXT(self, type_: TINYTEXT, **kw):
255
- return "TINYTEXT"
337
+ return self._extend_string(type_, {}, "TINYTEXT")
256
338
 
257
339
  def visit_MEDIUMTEXT(self, type_: MEDIUMTEXT, **kw):
258
- return "MEDIUMTEXT"
340
+ return self._extend_string(type_, {}, "MEDIUMTEXT")
259
341
 
260
342
  def visit_LONGTEXT(self, type_: LONGTEXT, **kw):
261
- return "LONGTEXT"
262
-
263
- def visit_NVARCHAR(self, type_: NVARCHAR, **kw):
264
- return "NVARCHAR"
265
-
266
- def visit_NCHAR(self, type_: NCHAR, **kw):
267
- return "NCHAR"
268
-
269
- def visit_TINYBLOB(self, type_: TINYBLOB, **kw):
270
- return "TINYBLOB"
271
-
272
- def visit_BLOB(self, type_: BLOB, **kw) -> str:
273
- blob = "BLOB"
274
- blob += f"({type_.length})" if type_.length is not None else ""
275
- return blob
276
-
277
- def visit_MEDIUMBLOB(self, type_: MEDIUMBLOB, **kw):
278
- return "MEDIUMBLOB"
279
-
280
- def visit_LONGBLOB(self, type_: LONGBLOB, **kw):
281
- return "LONGBLOB"
282
-
283
- # region visit lowercase
284
-
285
- def visit_integer(self, type_: INTEGER, **kw):
286
- return self.visit_INTEGER(type_, **kw)
287
-
288
- def visit_varchar(self, type_, **kw):
289
- return self.visit_VARCHAR(type_, **kw)
290
-
291
- def visit_char(self, type_, **kw):
292
- return self.visit_CHAR(type_, **kw)
293
-
294
- def visit_numeric(self, type_: NUMERIC, **kw):
295
- return self.visit_NUMERIC(type_, **kw)
296
-
297
- def visit_decimal(self, type_: DECIMAL, **kw):
298
- return self.visit_DECIMAL(type_, **kw)
299
-
300
- def visit_double(self, type_: DOUBLE, **kw):
301
- return self.visit_DOUBLE(type_, **kw)
343
+ return self._extend_string(type_, {}, "LONGTEXT")
302
344
 
303
- def visit_real(self, type_: REAL, **kw):
304
- return self.visit_REAL(type_, **kw)
305
-
306
- def visit_float(self, type_: FLOAT, **kw):
307
- return self.visit_FLOAT(type_, **kw)
308
-
309
- def visit_bigint(self, type_: BIGINT, **kw):
310
- return self.visit_BIGINT(type_, **kw)
311
-
312
- def visit_mediumint(self, type_: MEDIUMINT, **kw):
313
- return self.visit_MEDIUMINT(type_, **kw)
314
-
315
- def visit_tinyint(self, type_: TINYINT, **kw):
316
- 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}")
317
350
 
318
- def visit_smallint(self, type_: SMALLINT, **kw):
319
- return self.visit_SMALLINT(type_, **kw)
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")
320
356
 
321
- def visit_bit(self, type_: BIT, **kw):
322
- return self.visit_BIT(type_, **kw)
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}")
323
368
 
324
- def visit_time(self, type_: TIME, **kw):
325
- return self.visit_TIME(type_, **kw)
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")
326
380
 
327
- def visit_timestamp(self, type_: TIMESTAMP, **kw):
328
- return self.visit_TIMESTAMP(type_, **kw)
381
+ def visit_UUID(self, type_: UUID, **kw):
382
+ return "UUID"
329
383
 
330
- def visit_datetime(self, type_: DATETIME, **kw):
331
- return self.visit_DATETIME(type_, **kw)
384
+ def visit_VARBINARY(self, type_: VARBINARY, **kw):
385
+ return f"VARBINARY({type_.length})"
332
386
 
333
- def visit_year(self, type_: YEAR, **kw):
334
- return self.visit_YEAR(type_, **kw)
387
+ def visit_JSON(self, type_, **kw):
388
+ return "JSON"
335
389
 
336
- def visit_text(self, type_: TEXT, **kw):
337
- return self.visit_TEXT(type_, **kw)
390
+ def visit_large_binary(self, type_: LARGEBINARY, **kw):
391
+ return self.visit_BLOB(type_)
338
392
 
339
- def visit_tinytext(self, type_: TINYTEXT, **kw):
340
- return self.visit_TINYTEXT(type_, **kw)
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)
341
398
 
342
- def visit_mediumtext(self, type_: MEDIUMTEXT, **kw):
343
- return self.visit_MEDIUMTEXT(type_, **kw)
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"
344
404
 
345
- def visit_longtext(self, type_: LONGTEXT, **kw):
346
- return self.visit_LONGTEXT(type_, **kw)
405
+ def visit_TINYBLOB(self, type_: TINYBLOB, **kw):
406
+ return "TINYBLOB"
347
407
 
348
- def visit_nvarchar(self, type_: NVARCHAR, **kw):
349
- return self.visit_NVARCHAR(type_, **kw)
408
+ def visit_MEDIUMBLOB(self, type_: MEDIUMBLOB, **kw):
409
+ return "MEDIUMBLOB"
350
410
 
351
- def visit_nchar(self, type_: NCHAR, **kw):
352
- return self.visit_NCHAR(type_, **kw)
411
+ def visit_LONGBLOB(self, type_: LONGBLOB, **kw):
412
+ return "LONGBLOB"
353
413
 
354
- def visit_tinyblob(self, type_: TINYBLOB, **kw):
355
- return self.visit_TINYBLOB(type_, **kw)
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)})")
356
421
 
357
- def visit_mediumblob(self, type_: MEDIUMBLOB, **kw):
358
- return self.visit_MEDIUMBLOB(type_, **kw)
422
+ def visit_ENUM(self, type_, **kw):
423
+ return self._visit_enumerated_values("ENUM", type_, type_.enums)
359
424
 
360
- def visit_longblob(self, type_: LONGBLOB, **kw):
361
- return self.visit_LONGBLOB(type_, **kw)
425
+ def visit_SET(self, type_, **kw):
426
+ return self._visit_enumerated_values("SET", type_, type_.values)
362
427
 
363
- # endregion
428
+ def visit_BOOLEAN(self, type_: BOOLEAN, **kw):
429
+ return "BOOL"
364
430
 
365
431
 
366
432
  class MySQLDialect(default.DefaultDialect):
@@ -32,7 +32,7 @@ class _NumericType(_NumericCommonType, sqltypes.Numeric): ...
32
32
  class _FloatType(_NumericCommonType, sqltypes.Float):
33
33
  def __init__(self, precision=None, scale=None, asdecimal=True, **kw):
34
34
  if isinstance(self, (REAL, DOUBLE)) and ((precision is None and scale is not None) or (precision is not None and scale is None)):
35
- raise AttributeError("You must specify both precision and scale or omit " "both altogether.")
35
+ raise AttributeError("You must specify both precision and scale or omit both altogether.")
36
36
  super().__init__(precision=precision, asdecimal=asdecimal, **kw)
37
37
  self.scale = scale
38
38
 
@@ -42,6 +42,9 @@ class _IntegerType(_NumericCommonType, sqltypes.Integer):
42
42
  self.display_width = display_width
43
43
  super().__init__(**kw)
44
44
 
45
+ def __repr__(self):
46
+ return f"{type(self).__name__}({self.display_width})"
47
+
45
48
 
46
49
  class _StringType(sqltypes.String):
47
50
  """Base for MySQL string types."""
@@ -9,6 +9,7 @@ from ormlambda.sql.types import (
9
9
  TableType,
10
10
  ColumnType,
11
11
  AliasType,
12
+ TypeEngine,
12
13
  )
13
14
  from .interface import IClauseInfo
14
15
  from ormlambda.sql import ForeignKey
@@ -166,6 +167,18 @@ class ClauseInfo[T: Table](IClauseInfo[T]):
166
167
  return self._column
167
168
  return type(self._column)
168
169
 
170
+ @property
171
+ def dbtype(self)->tp.Optional[TypeEngine]:
172
+ if self._dtype is not None:
173
+ return self._dtype
174
+
175
+ if isinstance(self._column, Column):
176
+ return self._column.dbtype
177
+
178
+ if isinstance(self._column, type):
179
+ return self._column
180
+ return type(self._column)
181
+
169
182
  def query(self, dialect: Dialect, **kwargs) -> str:
170
183
  return self._create_query(dialect, **kwargs)
171
184
 
@@ -1,14 +1,14 @@
1
1
  from __future__ import annotations
2
2
  import abc
3
- from typing import Annotated, Any, Iterable, Type, Optional, TYPE_CHECKING, get_type_hints, overload, get_origin, get_args
3
+ from typing import Annotated, Any, ClassVar, Iterable, Type, Optional, TYPE_CHECKING, get_type_hints, overload, get_origin, get_args
4
4
  from ormlambda.sql.types import TableType, ComparerType, ColumnType
5
5
  from ormlambda import ConditionType
6
+ from ormlambda.sql.type_api import TypeEngine
6
7
 
7
8
  if TYPE_CHECKING:
8
9
  import re
9
10
  from ormlambda import Table
10
11
  from ormlambda.sql.comparer import Comparer, Regex, Like
11
- from ormlambda.sql.type_api import TypeEngine
12
12
 
13
13
 
14
14
  from ormlambda.types import (
@@ -24,10 +24,13 @@ from ormlambda.types import (
24
24
 
25
25
 
26
26
  class Column[TProp]:
27
- PRIVATE_CHAR: str = "_"
27
+ PRIVATE_CHAR: ClassVar[str] = "_"
28
+
29
+ _dbtype: Optional[TypeEngine]
28
30
 
29
31
  __slots__ = (
30
- "dtype",
32
+ "_dtype",
33
+ "_dbtype",
31
34
  "column_name",
32
35
  "table",
33
36
  "is_primary_key",
@@ -111,7 +114,8 @@ class Column[TProp]:
111
114
 
112
115
  def __set__(self, obj, value):
113
116
  if self._check and value is not None:
114
- if not isinstance(value, self.dtype):
117
+ type_ = self.dtype if not isinstance(self.dtype, TypeEngine) else self.dtype.python_type
118
+ if not isinstance(value, type_):
115
119
  raise ValueError(f"The '{self.column_name}' Column from '{self.table.__table_name__}' table expected '{str(self.dtype)}' type. You passed '{type(value).__name__}' type")
116
120
  setattr(obj, self.__private_name, value)
117
121
 
@@ -132,8 +136,6 @@ class Column[TProp]:
132
136
  def _fill_from_annotations[T: Table](self, obj: Type[T], name: str) -> None:
133
137
  """Read the metada when using Annotated typing class, and set the attributes accordingly"""
134
138
 
135
- from ormlambda.sql.type_api import TypeEngine
136
-
137
139
  annotations = get_type_hints(obj, include_extras=True)
138
140
  if name in annotations:
139
141
  annotation = annotations[name]
@@ -163,6 +165,23 @@ class Column[TProp]:
163
165
  self.is_not_null = True
164
166
  return None
165
167
 
168
+ @property
169
+ def dtype(self) -> Type[TProp]:
170
+ return self._dtype
171
+
172
+ @dtype.setter
173
+ def dtype(self, value: Type[TProp] | TypeEngine) -> None:
174
+ if isinstance(value, TypeEngine):
175
+ self._dtype = value.python_type
176
+ self._dbtype = value
177
+ else:
178
+ self._dtype = value
179
+ self._dbtype = None
180
+
181
+ @property
182
+ def dbtype(self) -> TypeEngine[TProp]:
183
+ return self._dbtype if self._dbtype else self.dtype
184
+
166
185
  @abc.abstractmethod
167
186
  def __comparer_creator(self, other: ColumnType, compare: ComparerType) -> Comparer:
168
187
  from ormlambda.sql.comparer import Comparer
@@ -10,6 +10,7 @@ import ormlambda.util as util
10
10
  from uuid import UUID as _python_UUID
11
11
  from shapely import Point as _python_Point
12
12
 
13
+
13
14
  class _NoArg(enum.Enum):
14
15
  NO_ARG = 0
15
16
 
@@ -391,7 +392,7 @@ class Enum(String, TypeEngine[EnumType]):
391
392
  enum_args = get_args(pt)
392
393
  bad_args = [arg for arg in enum_args if not isinstance(arg, str)]
393
394
  if bad_args:
394
- raise ValueError(f"Can't create string-based Enum datatype from non-string " f"values: {', '.join(repr(x) for x in bad_args)}. Please " f"provide an explicit Enum datatype for this Python type")
395
+ raise ValueError(f"Can't create string-based Enum datatype from non-string values: {', '.join(repr(x) for x in bad_args)}. Please provide an explicit Enum datatype for this Python type")
395
396
  native_enum = False
396
397
  return enum_args, native_enum
397
398
 
@@ -407,7 +408,7 @@ class Enum(String, TypeEngine[EnumType]):
407
408
  elif util.is_pep695(python_type):
408
409
  value = python_type.__value__
409
410
  if not util.is_literal(value):
410
- raise ValueError(f"Can't associate TypeAliasType '{python_type}' to an " "Enum since it's not a direct alias of a Literal. Only " "aliases in this form `type my_alias = Literal['a', " "'b']` are supported when generating Enums.")
411
+ raise ValueError(f"Can't associate TypeAliasType '{python_type}' to an Enum since it's not a direct alias of a Literal. Only aliases in this form `type my_alias = Literal['a', 'b']` are supported when generating Enums.")
411
412
  enum_args, native_enum = process_literal(value)
412
413
 
413
414
  elif isinstance(python_type, type) and issubclass(python_type, enum.Enum):
@@ -439,13 +440,15 @@ class Enum(String, TypeEngine[EnumType]):
439
440
 
440
441
  self._valid_lookup.update([(value, self._valid_lookup[self._object_lookup[value]]) for value in values])
441
442
 
443
+
442
444
  class Point(TypeEngine[_python_Point]):
443
- __visit_name__ = 'point'
445
+ __visit_name__ = "point"
444
446
 
445
447
  @property
446
- def python_type(self)->Type[_python_Point]:
448
+ def python_type(self) -> Type[_python_Point]:
447
449
  return _python_Point
448
-
450
+
451
+
449
452
  class JSON(TypeEngine[Any]):
450
453
  """JSON data type."""
451
454
 
@@ -597,6 +600,7 @@ class VARBINARY(Varbinary):
597
600
  class ENUM(Enum):
598
601
  __visit_name__ = "ENUM"
599
602
 
603
+
600
604
  class POINT(Point):
601
605
  __visit_name__ = "POINT"
602
606
 
@@ -623,13 +627,15 @@ _type_dicc: dict[Any, TypeEngine[Any]] = {
623
627
  float: Float(),
624
628
  NoneType: NULLTYPE,
625
629
  dt.datetime: Datetime(timezone=False),
630
+ dt.date: DATE(),
626
631
  bytes: _BINARY,
627
632
  bytearray: _BINARY,
628
633
  bool: Boolean(),
629
634
  enum.Enum: _ENUM,
630
635
  Literal: _ENUM,
631
636
  _python_UUID: UUID(),
632
- _python_Point: POINT()
637
+ _python_Point: POINT(),
638
+ decimal.Decimal: DECIMAL(),
633
639
  }
634
640
  # enderegion
635
641
 
@@ -33,3 +33,6 @@ class TypeEngine[T: Any](Element, abc.ABC):
33
33
  if _coerced_type is NULLTYPE:
34
34
  return self
35
35
  return _coerced_type
36
+
37
+ def __repr__(self):
38
+ return f"{TypeEngine.__name__}: {super().__repr__()}"