database-wrapper-mysql 0.1.44__py3-none-any.whl → 0.1.72__py3-none-any.whl

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.
@@ -35,7 +35,7 @@ class MySQL(DatabaseBackend):
35
35
  connection: MySqlConnection
36
36
  cursor: MySqlDictCursor
37
37
 
38
- def open(self):
38
+ def open(self) -> None:
39
39
  # Free resources
40
40
  if hasattr(self, "connection") and self.connection:
41
41
  self.close()
@@ -1,23 +1,16 @@
1
1
  import logging
2
2
  from typing import Any
3
3
 
4
- from MySQLdb.connections import Connection as MySqlConnection
5
- from MySQLdb.cursors import DictCursor as MySqlDictCursor
6
-
7
4
  from database_wrapper import DBWrapper
8
5
 
9
- from .connector import MySQL
6
+ from .connector import MySqlDictCursor
10
7
 
11
8
 
12
9
  class DBWrapperMysql(DBWrapper):
13
- """Base model for all RV4 models"""
14
-
15
- # Override db instance
16
- db: MySQL
17
- """ MySQL database connector """
10
+ """Wrapper for MySQL database"""
18
11
 
19
- dbConn: MySqlConnection | None = None
20
- """ MySQL connection object """
12
+ dbCursor: MySqlDictCursor
13
+ """ MySQL cursor object """
21
14
 
22
15
  #######################
23
16
  ### Class lifecycle ###
@@ -27,41 +20,30 @@ class DBWrapperMysql(DBWrapper):
27
20
  # We are overriding the __init__ method for the type hinting
28
21
  def __init__(
29
22
  self,
30
- db: MySQL | None = None,
31
- dbConn: MySqlConnection | None = None,
23
+ dbCursor: MySqlDictCursor | None = None,
32
24
  logger: logging.Logger | None = None,
33
25
  ):
34
26
  """
35
27
  Initializes a new instance of the DBWrapper class.
36
28
 
37
29
  Args:
38
- db (MySQL): The MySQL connector.
39
- dbConn (MySqlConnection, optional): The MySQL connection object. Defaults to None.
30
+ dbCursor (MySqlDictCursor): The MySQL database cursor object.
40
31
  logger (logging.Logger, optional): The logger object. Defaults to None.
41
32
  """
42
- super().__init__(db, dbConn, logger)
33
+ super().__init__(dbCursor, logger)
43
34
 
44
35
  ###############
45
36
  ### Setters ###
46
37
  ###############
47
38
 
48
- def setDb(self, db: MySQL | None) -> None:
49
- """
50
- Updates the database backend object.
51
-
52
- Args:
53
- db (MySQL | None): The new database backend object.
54
- """
55
- super().setDb(db)
56
-
57
- def setDbConn(self, dbConn: MySqlConnection | None) -> None:
39
+ def setDbCursor(self, dbCursor: MySqlDictCursor) -> None:
58
40
  """
59
- Updates the database connection object.
41
+ Updates the database cursor object.
60
42
 
61
43
  Args:
62
- dbConn (MySqlConnection | None): The new database connection object.
44
+ dbCursor (MySqlDictCursor): The new database cursor object.
63
45
  """
64
- super().setDbConn(dbConn)
46
+ super().setDbCursor(dbCursor)
65
47
 
66
48
  ######################
67
49
  ### Helper methods ###
@@ -92,6 +74,3 @@ class DBWrapperMysql(DBWrapper):
92
74
  if limit == 0:
93
75
  return None
94
76
  return f"LIMIT {offset},{limit}"
95
-
96
- def createCursor(self, emptyDataClass: Any | None = None) -> MySqlDictCursor:
97
- return self.db.connection.cursor(MySqlDictCursor)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: database_wrapper_mysql
3
- Version: 0.1.44
3
+ Version: 0.1.72
4
4
  Summary: database_wrapper for MySQL database
5
5
  Author-email: Gints Murans <gm@gm.lv>
6
6
  License: GNU General Public License v3.0 (GPL-3.0)
@@ -32,8 +32,8 @@ Classifier: Topic :: Software Development
32
32
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Requires-Python: >=3.8
34
34
  Description-Content-Type: text/markdown
35
- Requires-Dist: database-wrapper ==0.1.44
36
- Requires-Dist: mysqlclient >=2.2.2
35
+ Requires-Dist: database_wrapper==0.1.72
36
+ Requires-Dist: mysqlclient>=2.2.2
37
37
 
38
38
  # database_wrapper_mysql
39
39
 
@@ -60,7 +60,7 @@ db = MySQL({
60
60
  "database": "my_database"
61
61
  })
62
62
  db.open()
63
- dbWrapper = DBWrapperMySQL(db=db)
63
+ dbWrapper = DBWrapperMySQL(dbCursor=db.cursor)
64
64
 
65
65
  # Simple query
66
66
  aModel = MyModel()
@@ -0,0 +1,8 @@
1
+ database_wrapper_mysql/__init__.py,sha256=C_6Z9sbuvVF3Oy4xMlsekryRUZpReyOx0IhO-OCMVHY,649
2
+ database_wrapper_mysql/connector.py,sha256=2uSD1mhKOrCQ3deCLfThYMlQ5P9pxhPCSzppL6_-C-4,3349
3
+ database_wrapper_mysql/db_wrapper_mysql.py,sha256=t_FETaox5IR_v9ThG2ImMYM0mXPt3yGexwmVVp0bWlY,2007
4
+ database_wrapper_mysql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ database_wrapper_mysql-0.1.72.dist-info/METADATA,sha256=xX4ofUbU4mhF4L74wdJlT6AEZyznDXwZGs30ulEBGio,2870
6
+ database_wrapper_mysql-0.1.72.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
+ database_wrapper_mysql-0.1.72.dist-info/top_level.txt,sha256=hYkDzASh4xmHyKkhvI7Dy7QNkBoBGy-_dSPFdAo3QcQ,23
8
+ database_wrapper_mysql-0.1.72.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,8 +0,0 @@
1
- database_wrapper_mysql/__init__.py,sha256=C_6Z9sbuvVF3Oy4xMlsekryRUZpReyOx0IhO-OCMVHY,649
2
- database_wrapper_mysql/connector.py,sha256=OMr6iKOWYxQWW6AbZ51UcC6BRS3JFJJuV8x6Cy73gdw,3341
3
- database_wrapper_mysql/db_wrapper_mysql.py,sha256=KjDPCEAZHuuZqaPj8w5RnZsliAR2QGA2-WoWOj1TaV0,2690
4
- database_wrapper_mysql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- database_wrapper_mysql-0.1.44.dist-info/METADATA,sha256=S1uvJHD1JNE8yb-vSzArngf5P4Vbt1puExOvCG67hug,2859
6
- database_wrapper_mysql-0.1.44.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
7
- database_wrapper_mysql-0.1.44.dist-info/top_level.txt,sha256=hYkDzASh4xmHyKkhvI7Dy7QNkBoBGy-_dSPFdAo3QcQ,23
8
- database_wrapper_mysql-0.1.44.dist-info/RECORD,,