ormlambda 1.1.3__tar.gz → 1.2.1__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 (71) hide show
  1. {ormlambda-1.1.3 → ormlambda-1.2.1}/PKG-INFO +6 -2
  2. {ormlambda-1.1.3 → ormlambda-1.2.1}/README.md +4 -0
  3. {ormlambda-1.1.3 → ormlambda-1.2.1}/pyproject.toml +2 -3
  4. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/abstract_classes/abstract_model.py +1 -1
  5. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/interfaces/IRepositoryBase.py +4 -0
  6. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/interfaces/IStatements.py +4 -0
  7. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/dtypes.py +14 -1
  8. {ormlambda-1.1.3 → ormlambda-1.2.1}/LICENSE +0 -0
  9. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/__init__.py +0 -0
  10. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/__init__.py +0 -0
  11. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/abstract_classes/__init__.py +0 -0
  12. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/abstract_classes/non_query_base.py +0 -0
  13. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/abstract_classes/query_base.py +0 -0
  14. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/enums/__init__.py +0 -0
  15. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/enums/condition_types.py +0 -0
  16. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/enums/join_type.py +0 -0
  17. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/interfaces/INonQueryCommand.py +0 -0
  18. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/interfaces/IQueryCommand.py +0 -0
  19. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/common/interfaces/__init__.py +0 -0
  20. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/__init__.py +0 -0
  21. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/delete/IDelete.py +0 -0
  22. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/delete/__init__.py +0 -0
  23. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/delete/abstract_delete.py +0 -0
  24. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/insert/IInsert.py +0 -0
  25. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/insert/__init__.py +0 -0
  26. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/insert/abstract_insert.py +0 -0
  27. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/select/ISelect.py +0 -0
  28. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/select/__init__.py +0 -0
  29. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/select/table_column.py +0 -0
  30. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/update/IUpdate.py +0 -0
  31. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/update/__init__.py +0 -0
  32. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/update/abstract_update.py +0 -0
  33. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/upsert/IUpsert.py +0 -0
  34. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/upsert/__init__.py +0 -0
  35. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/upsert/abstract_upsert.py +0 -0
  36. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/where/__init__.py +0 -0
  37. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/components/where/abstract_where.py +0 -0
  38. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/__init__.py +0 -0
  39. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/__init__.py +0 -0
  40. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/__init__.py +0 -0
  41. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/count.py +0 -0
  42. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/create_database.py +0 -0
  43. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/delete.py +0 -0
  44. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/drop_database.py +0 -0
  45. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/drop_table.py +0 -0
  46. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/insert.py +0 -0
  47. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/joins.py +0 -0
  48. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/limit.py +0 -0
  49. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/offset.py +0 -0
  50. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/order.py +0 -0
  51. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/select.py +0 -0
  52. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/update.py +0 -0
  53. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/upsert.py +0 -0
  54. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/clauses/where_condition.py +0 -0
  55. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/repository.py +0 -0
  56. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/databases/my_sql/statements.py +0 -0
  57. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/model_base.py +0 -0
  58. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/__init__.py +0 -0
  59. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/column.py +0 -0
  60. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/foreign_key.py +0 -0
  61. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/__init__.py +0 -0
  62. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/dis_types.py +0 -0
  63. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/disassembler.py +0 -0
  64. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/dtypes.py +0 -0
  65. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/name_of.py +0 -0
  66. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/nested_element.py +0 -0
  67. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/lambda_disassembler/tree_instruction.py +0 -0
  68. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/module_tree/__init__.py +0 -0
  69. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/module_tree/dfs_traversal.py +0 -0
  70. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/module_tree/dynamic_module.py +0 -0
  71. {ormlambda-1.1.3 → ormlambda-1.2.1}/src/ormlambda/utils/table_constructor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ormlambda
3
- Version: 1.1.3
3
+ Version: 1.2.1
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
@@ -8,9 +8,13 @@ Requires-Python: >=3.12,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.12
10
10
  Requires-Dist: fluent-validation (>=3.1.0,<4.0.0)
11
- Requires-Dist: mysql-connector (>=2.2.9,<3.0.0)
11
+ Requires-Dist: mysql-connector-python (>=2.2.9,<3.0.0)
12
12
  Description-Content-Type: text/markdown
13
13
 
14
+ ![PyPI version](https://img.shields.io/pypi/v/ormlambda.svg)
15
+ ![downloads](https://img.shields.io/pypi/dm/ormlambda?label=downloads)
16
+ ![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)
17
+
14
18
  # ormMySQL
15
19
  This ORM is designed to connect with a MySQL server, facilitating the management of various database queries. Built with flexibility and efficiency in mind, this ORM empowers developers to interact with the database using lambda functions, allowing for concise and expressive query construction.
16
20
 
@@ -1,3 +1,7 @@
1
+ ![PyPI version](https://img.shields.io/pypi/v/ormlambda.svg)
2
+ ![downloads](https://img.shields.io/pypi/dm/ormlambda?label=downloads)
3
+ ![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)
4
+
1
5
  # ormMySQL
2
6
  This ORM is designed to connect with a MySQL server, facilitating the management of various database queries. Built with flexibility and efficiency in mind, this ORM empowers developers to interact with the database using lambda functions, allowing for concise and expressive query construction.
3
7
 
@@ -3,19 +3,18 @@ line-length = 320
3
3
 
4
4
  [tool.poetry]
5
5
  name = "ormlambda"
6
- version = "1.1.3"
6
+ version = "1.2.1"
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"
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.12"
13
- mysql-connector = "^2.2.9"
13
+ mysql-connector-python= "^2.2.9"
14
14
  fluent-validation = "^3.1.0"
15
15
 
16
16
  [tool.poetry.group.test.dependencies]
17
17
  pandas = "^2.2.2"
18
- mysql-connector = "^2.2.9"
19
18
  ruff = "^0.4.5"
20
19
  python-decouple = "^3.8"
21
20
 
@@ -229,7 +229,7 @@ class AbstractSQLStatements[T: Table, TRepo](IStatements_two_generic[T, TRepo]):
229
229
  response = self.select(selector=selector, flavour=flavour, by=by)
230
230
 
231
231
  if flavour:
232
- return response[0]
232
+ return response[0] if response else None
233
233
 
234
234
  # response var could be return more than one element when we work with models an we
235
235
  # select columns from different tables using a join query
@@ -65,3 +65,7 @@ class IRepositoryBase[T](ABC):
65
65
  def set_config(self, value: dict[str, Any]) -> dict[str, Any]:
66
66
  """Method to update database config"""
67
67
  ...
68
+
69
+ @property
70
+ @abstractmethod
71
+ def database(self) -> Optional[str]: ...
@@ -220,6 +220,10 @@ class IStatements[T: Table](ABC):
220
220
  @overload
221
221
  def select_one[*Ts](self, selector: Callable[[T], tuple[*Ts]], *, by: Optional[Enum] = JoinType.INNER_JOIN) -> tuple[*Ts]: ...
222
222
  @overload
223
+ def select_one[T1](self, selector: Callable[[T], tuple[T1]], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type) -> T1: ...
224
+ @overload
225
+ def select_one[T1, TFlavour](self, selector: Callable[[T], T1], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[TFlavour]) -> T1: ...
226
+ @overload
223
227
  def select_one[*Ts](self, selector: Callable[[T], tuple[*Ts]], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[tuple]) -> tuple[*Ts]: ...
224
228
  @overload
225
229
  def select_one[TFlavour](self, selector: Callable[[T], tuple], *, by: Optional[Enum] = JoinType.INNER_JOIN, flavour: Type[TFlavour]) -> TFlavour: ...
@@ -66,8 +66,21 @@ DATE = Literal["DATE", "DATETIME(fsp)", "TIMESTAMP(fsp)", "TIME(fsp)", "YEAR"]
66
66
  def transform_py_dtype_into_query_dtype(dtype: Any) -> str:
67
67
  # TODOL: must be found a better way to convert python data type into SQL clauses
68
68
  # float -> DECIMAL(5,2) is an error
69
- dicc: dict[Any, str] = {int: "INTEGER", float: "FLOAT(5,2)", Decimal: "FLOAT", datetime.datetime: "DATETIME", datetime.date: "DATE", bytes: "BLOB", str: "VARCHAR(255)", np.uint64: "BIGINT UNSIGNED"}
69
+ dicc: dict[Any, str] = {
70
+ int: "INTEGER",
71
+ float: "FLOAT(5,2)",
72
+ Decimal: "FLOAT",
73
+ datetime.datetime: "DATETIME",
74
+ datetime.date: "DATE",
75
+ bytes: "BLOB",
76
+ bytearray: "BLOB",
77
+ str: "VARCHAR(255)",
78
+ np.uint64: "BIGINT UNSIGNED",
79
+ }
70
80
 
81
+ res = dicc.get(dtype, None)
82
+ if res is None:
83
+ raise ValueError(f"datatype '{dtype}' is not expected.")
71
84
  return dicc[dtype]
72
85
 
73
86
 
File without changes