ormlambda 3.34.1__tar.gz → 3.34.6__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 (158) hide show
  1. {ormlambda-3.34.1 → ormlambda-3.34.6}/PKG-INFO +1 -1
  2. {ormlambda-3.34.1 → ormlambda-3.34.6}/pyproject.toml +1 -1
  3. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/__init__.py +33 -0
  4. ormlambda-3.34.6/src/ormlambda/dialects/mysql/__init__.py +84 -0
  5. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/mysql/base.py +194 -127
  6. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/mysql/types.py +4 -1
  7. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/clause_info.py +13 -0
  8. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/column/column.py +26 -7
  9. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/sqltypes.py +18 -6
  10. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/type_api.py +3 -0
  11. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/visitors.py +3 -0
  12. ormlambda-3.34.1/src/ormlambda/dialects/mysql/__init__.py +0 -8
  13. {ormlambda-3.34.1 → ormlambda-3.34.6}/AUTHORS +0 -0
  14. {ormlambda-3.34.1 → ormlambda-3.34.6}/LICENSE +0 -0
  15. {ormlambda-3.34.1 → ormlambda-3.34.6}/README.md +0 -0
  16. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/caster/__init__.py +0 -0
  17. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/caster/base_caster.py +0 -0
  18. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/caster/caster.py +0 -0
  19. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/caster/interfaces/ICaster.py +0 -0
  20. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/caster/interfaces/__init__.py +0 -0
  21. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/__init__.py +0 -0
  22. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
  23. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/abstract_classes/clause_info_converter.py +0 -0
  24. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/abstract_classes/decomposition_query.py +0 -0
  25. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
  26. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
  27. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/enums/__init__.py +0 -0
  28. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/enums/condition_types.py +0 -0
  29. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/enums/join_type.py +0 -0
  30. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/errors/__init__.py +0 -0
  31. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/global_checker.py +0 -0
  32. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/ICustomAlias.py +0 -0
  33. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/IDecompositionQuery.py +0 -0
  34. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/IJoinSelector.py +0 -0
  35. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
  36. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
  37. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/common/interfaces/__init__.py +0 -0
  38. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/__init__.py +0 -0
  39. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/__init__.py +0 -0
  40. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/__init__.py +0 -0
  41. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/caster.py +0 -0
  42. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/__init__.py +0 -0
  43. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/boolean.py +0 -0
  44. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/bytes.py +0 -0
  45. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/date.py +0 -0
  46. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/datetime.py +0 -0
  47. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/decimal.py +0 -0
  48. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/float.py +0 -0
  49. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/int.py +0 -0
  50. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/iterable.py +0 -0
  51. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/none.py +0 -0
  52. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/point.py +0 -0
  53. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/caster/types/string.py +0 -0
  54. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/ST_AsText.py +0 -0
  55. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/ST_Contains.py +0 -0
  56. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/__init__.py +0 -0
  57. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/count.py +0 -0
  58. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/delete.py +0 -0
  59. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/drop_table.py +0 -0
  60. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/group_by.py +0 -0
  61. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/having.py +0 -0
  62. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/insert.py +0 -0
  63. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/joins.py +0 -0
  64. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/limit.py +0 -0
  65. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/offset.py +0 -0
  66. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/order.py +0 -0
  67. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/update.py +0 -0
  68. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/upsert.py +0 -0
  69. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/clauses/where.py +0 -0
  70. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/pool_types.py +0 -0
  71. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/databases/my_sql/repository.py +0 -0
  72. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/__init__.py +0 -0
  73. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/default/__init__.py +0 -0
  74. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/default/base.py +0 -0
  75. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/interface/__init__.py +0 -0
  76. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/interface/dialect.py +0 -0
  77. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/mysql/mysqlconnector.py +0 -0
  78. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/sqlite/__init__.py +0 -0
  79. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/sqlite/base.py +0 -0
  80. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/dialects/sqlite/pysqlite.py +0 -0
  81. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/engine/__init__.py +0 -0
  82. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/engine/base.py +0 -0
  83. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/engine/create.py +0 -0
  84. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/engine/url.py +0 -0
  85. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/engine/utils.py +0 -0
  86. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/env.py +0 -0
  87. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/errors.py +0 -0
  88. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/model/__init__.py +0 -0
  89. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/model/base_model.py +0 -0
  90. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/__init__.py +0 -0
  91. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/base_repository.py +0 -0
  92. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/interfaces/IDatabaseConnection.py +0 -0
  93. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/interfaces/IRepositoryBase.py +0 -0
  94. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/interfaces/__init__.py +0 -0
  95. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/repository/response.py +0 -0
  96. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/__init__.py +0 -0
  97. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/__init__.py +0 -0
  98. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/aggregate_function_base.py +0 -0
  99. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/clause_info_context.py +0 -0
  100. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/interface/IAggregate.py +0 -0
  101. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/interface/IClauseInfo.py +0 -0
  102. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clause_info/interface/__init__.py +0 -0
  103. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/__init__.py +0 -0
  104. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/alias.py +0 -0
  105. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/count.py +0 -0
  106. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/delete.py +0 -0
  107. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/group_by.py +0 -0
  108. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/having.py +0 -0
  109. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/insert.py +0 -0
  110. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/IDelete.py +0 -0
  111. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/IInsert.py +0 -0
  112. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/ISelect.py +0 -0
  113. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/IUpdate.py +0 -0
  114. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/IUpsert.py +0 -0
  115. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/interfaces/__init__.py +0 -0
  116. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/join/__init__.py +0 -0
  117. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/join/join_context.py +0 -0
  118. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/joins.py +0 -0
  119. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/limit.py +0 -0
  120. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/offset.py +0 -0
  121. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/order.py +0 -0
  122. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/select.py +0 -0
  123. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/update.py +0 -0
  124. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/upsert.py +0 -0
  125. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/clauses/where.py +0 -0
  126. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/column/__init__.py +0 -0
  127. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/comparer.py +0 -0
  128. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/compiler.py +0 -0
  129. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/ddl.py +0 -0
  130. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/elements.py +0 -0
  131. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/foreign_key.py +0 -0
  132. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/functions/__init__.py +0 -0
  133. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/functions/concat.py +0 -0
  134. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/functions/max.py +0 -0
  135. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/functions/min.py +0 -0
  136. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/functions/sum.py +0 -0
  137. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/interfaces/__init__.py +0 -0
  138. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/table/__init__.py +0 -0
  139. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/table/fields.py +0 -0
  140. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/table/table.py +0 -0
  141. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/table/table_constructor.py +0 -0
  142. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/sql/types.py +0 -0
  143. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/__init__.py +0 -0
  144. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/base_statement.py +0 -0
  145. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/interfaces/IStatements.py +0 -0
  146. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/interfaces/__init__.py +0 -0
  147. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/query_builder.py +0 -0
  148. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/statements.py +0 -0
  149. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/statements/types.py +0 -0
  150. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/types/__init__.py +0 -0
  151. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/types/metadata.py +0 -0
  152. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/__init__.py +0 -0
  153. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/load_module.py +0 -0
  154. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/module_tree/__init__.py +0 -0
  155. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/module_tree/dfs_traversal.py +0 -0
  156. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/module_tree/dynamic_module.py +0 -0
  157. {ormlambda-3.34.1 → ormlambda-3.34.6}/src/ormlambda/util/plugin_loader.py +0 -0
  158. {ormlambda-3.34.1 → ormlambda-3.34.6}/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.6
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.6"
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
+ )
@@ -0,0 +1,84 @@
1
+ from . import base
2
+ from . import mysqlconnector
3
+
4
+ from .base import BIGINT
5
+ from .base import BINARY
6
+ from .base import BIT
7
+ from .base import BLOB
8
+ from .base import BOOLEAN
9
+ from .base import CHAR
10
+ from .base import DATE
11
+ from .base import DATETIME
12
+ from .base import DECIMAL
13
+ from .base import DOUBLE
14
+ from .base import FLOAT
15
+ from .base import INTEGER
16
+ from .base import LONGBLOB
17
+ from .base import LONGTEXT
18
+ from .base import MEDIUMBLOB
19
+ from .base import MEDIUMINT
20
+ from .base import MEDIUMTEXT
21
+ from .base import NCHAR
22
+ from .base import NUMERIC
23
+ from .base import NVARCHAR
24
+ from .base import REAL
25
+ from .base import SMALLINT
26
+ from .base import TEXT
27
+ from .base import TIME
28
+ from .base import TIMESTAMP
29
+ from .base import TINYBLOB
30
+ from .base import TINYINT
31
+ from .base import TINYTEXT
32
+ from .base import VARBINARY
33
+ from .base import VARCHAR
34
+ from .base import YEAR
35
+
36
+
37
+
38
+ __all__ = (
39
+ "BIGINT",
40
+ "BINARY",
41
+ "BIT",
42
+ "BLOB",
43
+ "BOOLEAN",
44
+ "CHAR",
45
+ "DATE",
46
+ "DATETIME",
47
+ "DECIMAL",
48
+ "DOUBLE",
49
+ "ENUM",
50
+ "FLOAT",
51
+ "INET4",
52
+ "INET6",
53
+ "INTEGER",
54
+ "INTEGER",
55
+ "JSON",
56
+ "LONGBLOB",
57
+ "LONGTEXT",
58
+ "MEDIUMBLOB",
59
+ "MEDIUMINT",
60
+ "MEDIUMTEXT",
61
+ "NCHAR",
62
+ "NVARCHAR",
63
+ "NUMERIC",
64
+ "SET",
65
+ "SMALLINT",
66
+ "REAL",
67
+ "TEXT",
68
+ "TIME",
69
+ "TIMESTAMP",
70
+ "TINYBLOB",
71
+ "TINYINT",
72
+ "TINYTEXT",
73
+ "VARBINARY",
74
+ "VARCHAR",
75
+ "YEAR",
76
+ "dialect",
77
+ "insert",
78
+ "Insert",
79
+ "match",
80
+ )
81
+
82
+
83
+ # default dialect
84
+ base.dialect = dialect = mysqlconnector.dialect
@@ -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,16 @@ 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
+ BINARY,
50
+ )
51
+
40
52
 
41
53
  from ormlambda.databases.my_sql import MySQLRepository, MySQLCaster
42
54
 
@@ -73,7 +85,7 @@ class MySQLCompiler(compiler.SQLCompiler):
73
85
  """Overridden from base SQLCompiler value"""
74
86
 
75
87
  def visit_select(self, select: Select, **kw):
76
- return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect,**kw)}"
88
+ return f"{select.CLAUSE} {select.COLUMNS} FROM {select.FROM.query(self.dialect, **kw)}"
77
89
 
78
90
  def visit_group_by(self, groupby: GroupBy, **kw):
79
91
  column = groupby._create_query(self.dialect, **kw)
@@ -110,7 +122,7 @@ class MySQLCompiler(compiler.SQLCompiler):
110
122
  context = ClauseInfoContext(table_context=order._context._table_context, clause_context=None) if order._context else None
111
123
  for index, clause in enumerate(order._convert_into_clauseInfo(columns, context, dialect=self.dialect)):
112
124
  clause.alias_clause = None
113
- string_columns.append(f"{clause.query(self.dialect,**kw)} {str(order._order_type[index])}")
125
+ string_columns.append(f"{clause.query(self.dialect, **kw)} {str(order._order_type[index])}")
114
126
 
115
127
  return f"{order.FUNCTION_NAME()} {', '.join(string_columns)}"
116
128
 
@@ -122,7 +134,7 @@ class MySQLCompiler(compiler.SQLCompiler):
122
134
 
123
135
  class MySQLDDLCompiler(compiler.DDLCompiler):
124
136
  def get_column_specification(self, column: Column, **kwargs):
125
- colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.dtype)
137
+ colspec = column.column_name + " " + self.dialect.type_compiler_instance.process(column.dbtype)
126
138
  default = self.get_column_default_string(column)
127
139
  if default is not None:
128
140
  colspec += " DEFAULT " + default
@@ -164,7 +176,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
164
176
  return getattr(type_, name, defaults.get(name))
165
177
 
166
178
  if attr("charset"):
167
- charset = f"CHARACTER SET {attr("charset")}"
179
+ charset = f"CHARACTER SET {attr('charset')}"
168
180
  elif attr("ascii"):
169
181
  charset = "ASCII"
170
182
  elif attr("unicode"):
@@ -184,183 +196,238 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
184
196
  return " ".join([c for c in ("NATIONAL", spec, collation) if c is not None])
185
197
  return " ".join([c for c in (spec, charset, collation) if c is not None])
186
198
 
187
- def visit_INTEGER(self, type_: INTEGER, **kw):
188
- if self.mysql_type(type_) and type_.display_width is not None:
199
+ def _mysql_type(self, type_, **kw):
200
+ return isinstance(type, _StringType | _NumericCommonType)
201
+
202
+ def visit_NUMERIC(self, type_: NUMERIC, **kw):
203
+ if type_.precision is None:
204
+ return self._extend_numeric(type_, "NUMERIC")
205
+ elif type_.scale is None:
189
206
  return self._extend_numeric(
190
207
  type_,
191
- f"INTEGER(%({type_.display_width})s)",
208
+ f"NUMERIC({type_.precision})",
192
209
  )
193
210
  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"
211
+ return self._extend_numeric(
212
+ type_,
213
+ f"NUMERIC({type_.precision}, {type_.scale})",
214
+ )
209
215
 
210
216
  def visit_DECIMAL(self, type_: DECIMAL, **kw):
211
- return "DECIMAL"
217
+ if type_.precision is None:
218
+ return self._extend_numeric(type_, "DECIMAL")
219
+ elif type_.scale is None:
220
+ return self._extend_numeric(
221
+ type_,
222
+ f"DECIMAL({type_.precision})",
223
+ )
224
+ else:
225
+ return self._extend_numeric(
226
+ type_,
227
+ f"DECIMAL({type_.precision}, {type_.scale})",
228
+ )
212
229
 
213
230
  def visit_DOUBLE(self, type_: DOUBLE, **kw):
214
- return "DOUBLE"
231
+ if type_.precision is not None and type_.scale is not None:
232
+ return self._extend_numeric(
233
+ type_,
234
+ f"DOUBLE({type_.precision}, {type_.scale})",
235
+ )
236
+ else:
237
+ return self._extend_numeric(type_, "DOUBLE")
215
238
 
216
239
  def visit_REAL(self, type_: REAL, **kw):
217
- return "REAL"
240
+ if type_.precision is not None and type_.scale is not None:
241
+ return self._extend_numeric(
242
+ type_,
243
+ f"REAL({type_.precision}, {type_.scale})",
244
+ )
245
+ else:
246
+ return self._extend_numeric(type_, "REAL")
218
247
 
219
248
  def visit_FLOAT(self, type_: FLOAT, **kw):
220
- return "FLOAT"
249
+ if self._mysql_type(type_) and type_.scale is not None and type_.precision is not None:
250
+ return self._extend_numeric(type_, f"FLOAT({type_.precision}, {type_.scale})")
251
+ elif type_.precision is not None:
252
+ return self._extend_numeric(type_, f"FLOAT({type_.precision})")
253
+ else:
254
+ return self._extend_numeric(type_, "FLOAT")
255
+
256
+ def visit_INTEGER(self, type_: INTEGER, **kw):
257
+ if self._mysql_type(type_) and type_.display_width is not None:
258
+ return self._extend_numeric(
259
+ type_,
260
+ f"INTEGER({type_.display_width})",
261
+ )
262
+ else:
263
+ return self._extend_numeric(type_, "INTEGER")
221
264
 
222
265
  def visit_BIGINT(self, type_: BIGINT, **kw):
223
- return "BIGINT"
266
+ if self._mysql_type(type_) and type_.display_width is not None:
267
+ return self._extend_numeric(
268
+ type_,
269
+ f"BIGINT({type_.display_width})",
270
+ )
271
+ else:
272
+ return self._extend_numeric(type_, "BIGINT")
224
273
 
225
274
  def visit_MEDIUMINT(self, type_: MEDIUMINT, **kw):
226
- return "MEDIUMINT"
275
+ if self._mysql_type(type_) and type_.display_width is not None:
276
+ return self._extend_numeric(
277
+ type_,
278
+ f"MEDIUMINT({type_.display_width})",
279
+ )
280
+ else:
281
+ return self._extend_numeric(type_, "MEDIUMINT")
227
282
 
228
283
  def visit_TINYINT(self, type_: TINYINT, **kw):
229
- return "TINYINT"
284
+ if self._mysql_type(type_) and type_.display_width is not None:
285
+ return self._extend_numeric(type_, f"TINYINT({type_.display_width})")
286
+ else:
287
+ return self._extend_numeric(type_, "TINYINT")
230
288
 
231
289
  def visit_SMALLINT(self, type_: SMALLINT, **kw):
232
- return "SMALLINT"
290
+ if self._mysql_type(type_) and type_.display_width is not None:
291
+ return self._extend_numeric(
292
+ type_,
293
+ f"SMALLINT({type_.display_width})",
294
+ )
295
+ else:
296
+ return self._extend_numeric(type_, "SMALLINT")
233
297
 
234
298
  def visit_BIT(self, type_: BIT, **kw):
235
- return "BIT"
299
+ if type_.length is not None:
300
+ return f"BIT({type_.length})"
301
+ else:
302
+ return "BIT"
303
+
304
+ def visit_DATETIME(self, type_: DATETIME, **kw):
305
+ if getattr(type_, "fsp", None):
306
+ return f"DATETIME({type_.fsp})"
307
+ else:
308
+ return "DATETIME"
309
+
310
+ def visit_DATE(self, type_: DATE, **kw):
311
+ return "DATE"
236
312
 
237
313
  def visit_TIME(self, type_: TIME, **kw):
238
- return "TIME"
314
+ if getattr(type_, "fsp", None):
315
+ return f"TIME({type_.fsp})"
316
+ else:
317
+ return "TIME"
239
318
 
240
319
  def visit_TIMESTAMP(self, type_: TIMESTAMP, **kw):
241
- return "TIMESTAMP"
242
-
243
- def visit_DATETIME(self, type_: DATETIME, **kw):
244
- return "DATETIME"
320
+ if getattr(type_, "fsp", None):
321
+ return f"TIMESTAMP({type_.fsp})"
322
+ else:
323
+ return "TIMESTAMP"
245
324
 
246
325
  def visit_YEAR(self, type_: YEAR, **kw):
247
- return "YEAR"
326
+ if type_.display_width is None:
327
+ return "YEAR"
328
+ else:
329
+ return f"YEAR({type_.display_width})"
248
330
 
249
331
  def visit_TEXT(self, type_: TEXT, **kw):
250
332
  if type_.length is not None:
251
333
  return self._extend_string(type_, {}, f"TEXT({type_.length})")
252
- return self._extend_string(type_, {}, "TEXT")
334
+ else:
335
+ return self._extend_string(type_, {}, "TEXT")
253
336
 
254
337
  def visit_TINYTEXT(self, type_: TINYTEXT, **kw):
255
- return "TINYTEXT"
338
+ return self._extend_string(type_, {}, "TINYTEXT")
256
339
 
257
340
  def visit_MEDIUMTEXT(self, type_: MEDIUMTEXT, **kw):
258
- return "MEDIUMTEXT"
341
+ return self._extend_string(type_, {}, "MEDIUMTEXT")
259
342
 
260
343
  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)
344
+ return self._extend_string(type_, {}, "LONGTEXT")
302
345
 
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)
346
+ def visit_VARCHAR(self, type_: VARCHAR, **kw):
347
+ if type_.length is not None:
348
+ return self._extend_string(type_, {}, f"VARCHAR({type_.length})")
349
+ else:
350
+ raise ValueError(f"VARCHAR requires a length on dialect {self.dialect.name}")
317
351
 
318
- def visit_smallint(self, type_: SMALLINT, **kw):
319
- return self.visit_SMALLINT(type_, **kw)
352
+ def visit_CHAR(self, type_: CHAR, **kw):
353
+ if type_.length is not None:
354
+ return self._extend_string(type_, {}, f"CHAR({type_.length})")
355
+ else:
356
+ return self._extend_string(type_, {}, "CHAR")
320
357
 
321
- def visit_bit(self, type_: BIT, **kw):
322
- return self.visit_BIT(type_, **kw)
358
+ def visit_NVARCHAR(self, type_: NVARCHAR, **kw):
359
+ # We'll actually generate the equiv. "NATIONAL VARCHAR" instead
360
+ # of "NVARCHAR".
361
+ if type_.length is not None:
362
+ return self._extend_string(
363
+ type_,
364
+ {"national": True},
365
+ f"VARCHAR({type_.length})",
366
+ )
367
+ else:
368
+ raise ValueError(f"NVARCHAR requires a length on dialect {self.dialect.name}")
323
369
 
324
- def visit_time(self, type_: TIME, **kw):
325
- return self.visit_TIME(type_, **kw)
370
+ def visit_NCHAR(self, type_: NCHAR, **kw):
371
+ # We'll actually generate the equiv.
372
+ # "NATIONAL CHAR" instead of "NCHAR".
373
+ if type_.length is not None:
374
+ return self._extend_string(
375
+ type_,
376
+ {"national": True},
377
+ f"CHAR({type_.length})",
378
+ )
379
+ else:
380
+ return self._extend_string(type_, {"national": True}, "CHAR")
326
381
 
327
- def visit_timestamp(self, type_: TIMESTAMP, **kw):
328
- return self.visit_TIMESTAMP(type_, **kw)
382
+ def visit_UUID(self, type_: UUID, **kw):
383
+ return "UUID"
329
384
 
330
- def visit_datetime(self, type_: DATETIME, **kw):
331
- return self.visit_DATETIME(type_, **kw)
385
+ def visit_VARBINARY(self, type_: VARBINARY, **kw):
386
+ return f"VARBINARY({type_.length})"
332
387
 
333
- def visit_year(self, type_: YEAR, **kw):
334
- return self.visit_YEAR(type_, **kw)
388
+ def visit_JSON(self, type_, **kw):
389
+ return "JSON"
335
390
 
336
- def visit_text(self, type_: TEXT, **kw):
337
- return self.visit_TEXT(type_, **kw)
391
+ def visit_large_binary(self, type_: LARGEBINARY, **kw):
392
+ return self.visit_BLOB(type_)
338
393
 
339
- def visit_tinytext(self, type_: TINYTEXT, **kw):
340
- return self.visit_TINYTEXT(type_, **kw)
394
+ def visit_enum(self, type_, **kw):
395
+ if not type_.native_enum:
396
+ return super().visit_enum(type_)
397
+ else:
398
+ return self.visit_ENUM(type_, type_.enums)
341
399
 
342
- def visit_mediumtext(self, type_: MEDIUMTEXT, **kw):
343
- return self.visit_MEDIUMTEXT(type_, **kw)
400
+ def visit_BLOB(self, type_: BLOB, **kw):
401
+ if type_.length is not None:
402
+ return f"BLOB({type_.length})"
403
+ else:
404
+ return "BLOB"
344
405
 
345
- def visit_longtext(self, type_: LONGTEXT, **kw):
346
- return self.visit_LONGTEXT(type_, **kw)
406
+ def visit_TINYBLOB(self, type_: TINYBLOB, **kw):
407
+ return "TINYBLOB"
347
408
 
348
- def visit_nvarchar(self, type_: NVARCHAR, **kw):
349
- return self.visit_NVARCHAR(type_, **kw)
409
+ def visit_MEDIUMBLOB(self, type_: MEDIUMBLOB, **kw):
410
+ return "MEDIUMBLOB"
350
411
 
351
- def visit_nchar(self, type_: NCHAR, **kw):
352
- return self.visit_NCHAR(type_, **kw)
412
+ def visit_LONGBLOB(self, type_: LONGBLOB, **kw):
413
+ return "LONGBLOB"
353
414
 
354
- def visit_tinyblob(self, type_: TINYBLOB, **kw):
355
- return self.visit_TINYBLOB(type_, **kw)
415
+ def _visit_enumerated_values(self, name, type_, enumerated_values):
416
+ quoted_enums = []
417
+ for e in enumerated_values:
418
+ if self.dialect.identifier_preparer._double_percents:
419
+ e = e.replace("%", "%%")
420
+ quoted_enums.append(f"'{e.replace("'", "''")}'")
421
+ return self._extend_string(type_, {}, f"{name}({','.join(quoted_enums)})")
356
422
 
357
- def visit_mediumblob(self, type_: MEDIUMBLOB, **kw):
358
- return self.visit_MEDIUMBLOB(type_, **kw)
423
+ def visit_ENUM(self, type_, **kw):
424
+ return self._visit_enumerated_values("ENUM", type_, type_.enums)
359
425
 
360
- def visit_longblob(self, type_: LONGBLOB, **kw):
361
- return self.visit_LONGBLOB(type_, **kw)
426
+ def visit_SET(self, type_, **kw):
427
+ return self._visit_enumerated_values("SET", type_, type_.values)
362
428
 
363
- # endregion
429
+ def visit_BOOLEAN(self, type_: BOOLEAN, **kw):
430
+ return "BOOL"
364
431
 
365
432
 
366
433
  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