database-wrapper-mysql 0.1.86__py3-none-any.whl → 0.2.4__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.
@@ -73,7 +73,7 @@ class MySQL(DatabaseBackend):
73
73
  # We keep the same behavior not to break services that have port
74
74
  # number unspecified.
75
75
  port=self.config.get("port", 0),
76
- connect_timeout=self.connectionTimeout,
76
+ connect_timeout=self.connection_timeout,
77
77
  use_unicode=True,
78
78
  charset=self.config["charset"],
79
79
  collation=self.config["collation"],
@@ -81,12 +81,12 @@ class MySQL(DatabaseBackend):
81
81
  **self.config["kwargs"],
82
82
  )
83
83
  # TODO: Typings issue
84
- self.cursor = self.connection.cursor(MySqlDictCursor) # type: ignore
84
+ self.cursor = self.connection.cursor(MySqlDictCursor) # type: ignore[mysql does not have valid type hint]
85
85
 
86
86
  def ping(self) -> bool:
87
87
  try:
88
- self.cursor.execute("SELECT 1")
89
- self.cursor.fetchone()
88
+ self.cursor.execute("SELECT 1") # type: ignore[mysql does not have valid type hint]
89
+ self.cursor.fetchone() # type: ignore[mysql does not have valid type hint]
90
90
  except Exception as e:
91
91
  self.logger.debug(f"Error while pinging the database: {e}")
92
92
  return False
@@ -97,11 +97,11 @@ class MySQL(DatabaseBackend):
97
97
  ### Data ###
98
98
  ############
99
99
 
100
- def lastInsertId(self) -> int:
100
+ def last_insert_id(self) -> int:
101
101
  assert self.cursor, "Cursor is not initialized"
102
102
  return self.cursor.lastrowid
103
103
 
104
- def affectedRows(self) -> int:
104
+ def affected_rows(self) -> int:
105
105
  assert self.cursor, "Cursor is not initialized"
106
106
  return self.cursor.rowcount
107
107
 
@@ -111,7 +111,7 @@ class MySQL(DatabaseBackend):
111
111
 
112
112
  self.logger.debug("Commit DB queries..")
113
113
  # TODO: Typings issue
114
- self.connection.commit() # type: ignore
114
+ self.connection.commit() # type: ignore[mysql does not have valid type hint]
115
115
 
116
116
  def rollback(self) -> None:
117
117
  """Rollback DB queries"""
@@ -119,4 +119,4 @@ class MySQL(DatabaseBackend):
119
119
 
120
120
  self.logger.debug("Rollback DB queries..")
121
121
  # TODO: Typings issue
122
- self.connection.rollback() # type: ignore
122
+ self.connection.rollback() # type: ignore[mysql does not have valid type hint]
@@ -9,7 +9,7 @@ from .connector import MySqlDictCursor
9
9
  class DBWrapperMysql(DBWrapper):
10
10
  """Wrapper for MySQL database"""
11
11
 
12
- dbCursor: MySqlDictCursor | None
12
+ db_cursor: MySqlDictCursor | None
13
13
  """ MySQL cursor object """
14
14
 
15
15
  #######################
@@ -20,36 +20,36 @@ class DBWrapperMysql(DBWrapper):
20
20
  # We are overriding the __init__ method for the type hinting
21
21
  def __init__(
22
22
  self,
23
- dbCursor: MySqlDictCursor | None = None,
23
+ db_cursor: MySqlDictCursor | None = None,
24
24
  logger: logging.Logger | None = None,
25
25
  ):
26
26
  """
27
27
  Initializes a new instance of the DBWrapper class.
28
28
 
29
29
  Args:
30
- dbCursor (MySqlDictCursor): The MySQL database cursor object.
30
+ db_cursor (MySqlDictCursor): The MySQL database cursor object.
31
31
  logger (logging.Logger, optional): The logger object. Defaults to None.
32
32
  """
33
- super().__init__(dbCursor, logger)
33
+ super().__init__(db_cursor, logger)
34
34
 
35
35
  ###############
36
36
  ### Setters ###
37
37
  ###############
38
38
 
39
- def setDbCursor(self, dbCursor: MySqlDictCursor | None) -> None:
39
+ def set_db_cursor(self, db_cursor: MySqlDictCursor | None) -> None:
40
40
  """
41
41
  Updates the database cursor object.
42
42
 
43
43
  Args:
44
- dbCursor (MySqlDictCursor): The new database cursor object.
44
+ db_cursor (MySqlDictCursor): The new database cursor object.
45
45
  """
46
- super().setDbCursor(dbCursor)
46
+ super().set_db_cursor(db_cursor)
47
47
 
48
48
  ######################
49
49
  ### Helper methods ###
50
50
  ######################
51
51
 
52
- def logQuery(
52
+ def log_query(
53
53
  self,
54
54
  cursor: MySqlDictCursor,
55
55
  query: Any,
@@ -63,14 +63,14 @@ class DBWrapperMysql(DBWrapper):
63
63
  query (Any): The query to log.
64
64
  params (tuple[Any, ...]): The parameters to log.
65
65
  """
66
- queryString = cursor.mogrify(query, params)
67
- logging.getLogger().debug(f"Query: {queryString}")
66
+ query_string = cursor.mogrify(query, params)
67
+ logging.getLogger().debug(f"Query: {query_string}")
68
68
 
69
69
  #####################
70
70
  ### Query methods ###
71
71
  #####################
72
72
 
73
- def limitQuery(self, offset: int = 0, limit: int = 100) -> str | None:
73
+ def limit_query(self, offset: int = 0, limit: int = 100) -> str | None:
74
74
  if limit == 0:
75
75
  return None
76
76
  return f"LIMIT {offset},{limit}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: database_wrapper_mysql
3
- Version: 0.1.86
3
+ Version: 0.2.4
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,7 +32,7 @@ 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.86
35
+ Requires-Dist: database_wrapper==0.2.4
36
36
  Requires-Dist: mysqlclient>=2.2.2
37
37
 
38
38
  # database_wrapper_mysql
@@ -0,0 +1,8 @@
1
+ database_wrapper_mysql/__init__.py,sha256=C_6Z9sbuvVF3Oy4xMlsekryRUZpReyOx0IhO-OCMVHY,649
2
+ database_wrapper_mysql/connector.py,sha256=RRWIOu6xIqH6MB86reZrvhmDrZ1nsGBsRukGDAoyHVY,3962
3
+ database_wrapper_mysql/db_wrapper_mysql.py,sha256=osGON5FYYujosrWnkptCXFPFUsK6EE1T_W5BxOXn3r4,2036
4
+ database_wrapper_mysql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ database_wrapper_mysql-0.2.4.dist-info/METADATA,sha256=EgPid1QmR2U0WUkdOFxiBnVKPGj_eH5jRCH2bx5zsyw,2868
6
+ database_wrapper_mysql-0.2.4.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
7
+ database_wrapper_mysql-0.2.4.dist-info/top_level.txt,sha256=hYkDzASh4xmHyKkhvI7Dy7QNkBoBGy-_dSPFdAo3QcQ,23
8
+ database_wrapper_mysql-0.2.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.7.1)
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=w_YFPesqXnqd0BH6mnSeOQT6llD82mDtwQPdKB_foUs,3741
3
- database_wrapper_mysql/db_wrapper_mysql.py,sha256=001zPvYAE0klD79DXHoPpn8UB68H3Fu0Gx7_kVOyxyI,2021
4
- database_wrapper_mysql/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- database_wrapper_mysql-0.1.86.dist-info/METADATA,sha256=bHjX3wkusEPluHCuHbszMpYV1A57oTcpnXZbSeCWX9c,2870
6
- database_wrapper_mysql-0.1.86.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
7
- database_wrapper_mysql-0.1.86.dist-info/top_level.txt,sha256=hYkDzASh4xmHyKkhvI7Dy7QNkBoBGy-_dSPFdAo3QcQ,23
8
- database_wrapper_mysql-0.1.86.dist-info/RECORD,,