manage-sql 1.0.2.dev1302__tar.gz → 1.0.2.dev1303__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 (18) hide show
  1. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/PKG-INFO +1 -1
  2. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/SQLITE.py +45 -34
  3. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql.egg-info/PKG-INFO +1 -1
  4. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/setup.py +1 -1
  5. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/LICENCE +0 -0
  6. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/README.md +0 -0
  7. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/MYSQL.py +0 -0
  8. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/POSTGRESQL.py +0 -0
  9. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/__init__.py +0 -0
  10. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/utils_mysql.py +0 -0
  11. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/utils_postgres.py +0 -0
  12. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/Utils/utils_sqlite.py +0 -0
  13. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql/__init__.py +0 -0
  14. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql.egg-info/SOURCES.txt +0 -0
  15. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql.egg-info/dependency_links.txt +0 -0
  16. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql.egg-info/requires.txt +0 -0
  17. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/manage_sql.egg-info/top_level.txt +0 -0
  18. {manage_sql-1.0.2.dev1302 → manage_sql-1.0.2.dev1303}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: manage-sql
3
- Version: 1.0.2.dev1302
3
+ Version: 1.0.2.dev1303
4
4
  Summary: Python library for managing SQLite, MySQL, and PostgreSQL databases with greater efficiency.
5
5
  Home-page: https://github.com/webtechmoz/manage-sql.git
6
6
  Author: Web Tech Moz
@@ -65,42 +65,13 @@ class SQLITE:
65
65
  self.delete_by = Filter
66
66
  self.ColumnData = ColumnData
67
67
  self.__sql_multiprocess = SQLITE_MULTI(
68
- connection=self.__connect
68
+ database= self.__database,
69
+ path= self.__path
69
70
  )
70
71
 
71
72
  @property
72
73
  def __connect(self) -> tuple[sq.Connection, sq.Cursor]:
73
- """
74
- Establishes a connection to the SQLite database and returns the connection and cursor.
75
-
76
- Returns:
77
- tuple[Connection, Cursor]: The SQLite connection and cursor.
78
-
79
- Raises:
80
- Exception:
81
- If there is an error connecting to the database or creating the directory.
82
- """
83
- def create_connection() -> tuple[sq.Connection, sq.Cursor]:
84
-
85
- if not self.__path.endswith('.db'):
86
- self.__path = os.path.join(self.__path, f'{self.__database}.db')
87
-
88
- connection = sq.connect(self.__path)
89
- cursor = connection.cursor()
90
-
91
- return connection, cursor
92
-
93
- try:
94
- os.mkdir(path=self.__path)
95
-
96
- return create_connection()
97
-
98
- except Exception as e:
99
- if 'WinError 183' in str(e):
100
- return create_connection()
101
-
102
- else:
103
- self.__exception_error(message_error=e)
74
+ return self.__sql_multiprocess.public_connect
104
75
 
105
76
  @property
106
77
  def tables(self) -> list[Table]:
@@ -439,9 +410,49 @@ class SQLITE:
439
410
  class SQLITE_MULTI:
440
411
  def __init__(
441
412
  self,
442
- connection: tuple[sq.Connection, sq.Cursor]
413
+ database: str,
414
+ path: str
443
415
  ):
444
- self.__connect = connection
416
+ self.__database = database
417
+ self.__path = path
418
+
419
+ @property
420
+ def __connect(self) -> tuple[sq.Connection, sq.Cursor]:
421
+ """
422
+ Establishes a connection to the SQLite database and returns the connection and cursor.
423
+
424
+ Returns:
425
+ tuple[Connection, Cursor]: The SQLite connection and cursor.
426
+
427
+ Raises:
428
+ Exception:
429
+ If there is an error connecting to the database or creating the directory.
430
+ """
431
+ def create_connection() -> tuple[sq.Connection, sq.Cursor]:
432
+
433
+ if not self.__path.endswith('.db'):
434
+ self.__path = os.path.join(self.__path, f'{self.__database}.db')
435
+
436
+ connection = sq.connect(self.__path)
437
+ cursor = connection.cursor()
438
+
439
+ return connection, cursor
440
+
441
+ try:
442
+ os.mkdir(path=self.__path)
443
+
444
+ return create_connection()
445
+
446
+ except Exception as e:
447
+ if 'WinError 183' in str(e):
448
+ return create_connection()
449
+
450
+ else:
451
+ self.__exception_error(message_error=e)
452
+
453
+ @property
454
+ def public_connect(self):
455
+ return self.__connect
445
456
 
446
457
  def create_table_multi(self, table_name: str, columns: str):
447
458
  connection, cursor = self.__connect
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: manage-sql
3
- Version: 1.0.2.dev1302
3
+ Version: 1.0.2.dev1303
4
4
  Summary: Python library for managing SQLite, MySQL, and PostgreSQL databases with greater efficiency.
5
5
  Home-page: https://github.com/webtechmoz/manage-sql.git
6
6
  Author: Web Tech Moz
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='manage-sql',
5
- version='1.0.2.dev1302',
5
+ version='1.0.2.dev1303',
6
6
  author='Web Tech Moz',
7
7
  author_email='zoidycine@gmail.com',
8
8
  description='Python library for managing SQLite, MySQL, and PostgreSQL databases with greater efficiency.',