manage-sql 0.5.4__tar.gz → 0.6.0.dev826__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.
@@ -1,13 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: manage-sql
3
- Version: 0.5.4
3
+ Version: 0.6.0.dev826
4
4
  Summary: Biblioteca Python para gestão de bases de dados SQLite, MYSQL e PostgreSQL com maior eficiência
5
5
  Home-page: https://github.com/webtechmoz/manage-sql.git
6
6
  Author: Web Tech Moz
7
7
  Author-email: zoidycine@gmail.com
8
8
  License: MIT
9
9
  Keywords: manage-sql,sqlite,sqlite manager,mysql,mysql manager,mysql python,mysql connector,postgresql connector,postgresql,postgresql python
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.11
10
12
  Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.6
11
15
  Classifier: License :: OSI Approved :: MIT License
12
16
  Classifier: Operating System :: OS Independent
13
17
  Requires-Python: >=3.6
@@ -15,6 +19,7 @@ Description-Content-Type: text/markdown
15
19
  License-File: LICENCE
16
20
  Requires-Dist: mysql-connector
17
21
  Requires-Dist: mysql-connector-python
22
+ Requires-Dist: psycopg2
18
23
  Requires-Dist: psycopg2-binary
19
24
 
20
25
  # GESTÃO DE BANCOS DE DADOS (MYSQL | SQLITE | POSTGRESQL)
@@ -41,7 +41,7 @@ class POSTGRESQL:
41
41
  ```
42
42
  '''
43
43
 
44
- def __init__(self, host: str, user: str = 'postgres', database: str = None, password: str = '', port: int = 5432):
44
+ def __init__(self, postgre_url: str = None, host: str = None, user: str = None, database: str = None, password: str = '', port: int = 5432):
45
45
  """
46
46
  Inicializa a classe com o nome do banco de dados.
47
47
 
@@ -68,6 +68,7 @@ class POSTGRESQL:
68
68
  self.password = password
69
69
  self.database = database
70
70
  self.port = port
71
+ self.postgre_url = postgre_url
71
72
 
72
73
  @property
73
74
  def numeroTabelas(self) -> int:
@@ -137,30 +138,27 @@ class POSTGRESQL:
137
138
 
138
139
 
139
140
  try:
140
- database = postgresql.connect(
141
- host=self.host,
142
- user=self.user,
143
- password=self.password,
144
- port=self.port
145
- )
146
-
147
- database.autocommit = True
148
- database.cursor().execute(f'CREATE DATABASE {self.database}')
149
-
150
- database = postgresql.connect(
151
- host=self.host,
152
- user=self.user,
153
- password=self.password,
154
- database=self.database,
155
- port=self.port
156
- )
157
-
158
- cursor = database.cursor()
141
+ if self.postgre_url != None:
142
+ database = postgresql.connect(
143
+ dsn=self.postgre_url
144
+ )
145
+
146
+ database.autocommit = True
147
+ cursor = database.cursor()
148
+
149
+ return database, cursor
159
150
 
160
- return database, cursor
161
-
162
- except Exception as e:
163
- if 'already exists' in str(e):
151
+ else:
152
+ database = postgresql.connect(
153
+ host=self.host,
154
+ user=self.user,
155
+ password=self.password,
156
+ port=self.port
157
+ )
158
+
159
+ database.autocommit = True
160
+ database.cursor().execute(f'CREATE DATABASE {self.database}')
161
+
164
162
  database = postgresql.connect(
165
163
  host=self.host,
166
164
  user=self.user,
@@ -169,13 +167,27 @@ class POSTGRESQL:
169
167
  port=self.port
170
168
  )
171
169
 
172
- database.autocommit = True
173
170
  cursor = database.cursor()
174
-
171
+
175
172
  return database, cursor
176
-
177
- else:
178
- print(f'Erro: {e}')
173
+
174
+ except Exception as e:
175
+ if self.postgre_url == None:
176
+ if 'already exists' in str(e):
177
+ database = postgresql.connect(
178
+ host=self.host,
179
+ user=self.user,
180
+ password=self.password,
181
+ database=self.database,
182
+ port=self.port
183
+ )
184
+
185
+ database.autocommit = True
186
+ cursor = database.cursor()
187
+
188
+ return database, cursor
189
+
190
+ print(f'Erro: {e}')
179
191
 
180
192
 
181
193
  def criarTabela(self, nomeTabela: str, Colunas: list, ColunasTipo: list):
@@ -1,13 +1,17 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: manage-sql
3
- Version: 0.5.4
3
+ Version: 0.6.0.dev826
4
4
  Summary: Biblioteca Python para gestão de bases de dados SQLite, MYSQL e PostgreSQL com maior eficiência
5
5
  Home-page: https://github.com/webtechmoz/manage-sql.git
6
6
  Author: Web Tech Moz
7
7
  Author-email: zoidycine@gmail.com
8
8
  License: MIT
9
9
  Keywords: manage-sql,sqlite,sqlite manager,mysql,mysql manager,mysql python,mysql connector,postgresql connector,postgresql,postgresql python
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.11
10
12
  Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.7
14
+ Classifier: Programming Language :: Python :: 3.6
11
15
  Classifier: License :: OSI Approved :: MIT License
12
16
  Classifier: Operating System :: OS Independent
13
17
  Requires-Python: >=3.6
@@ -15,6 +19,7 @@ Description-Content-Type: text/markdown
15
19
  License-File: LICENCE
16
20
  Requires-Dist: mysql-connector
17
21
  Requires-Dist: mysql-connector-python
22
+ Requires-Dist: psycopg2
18
23
  Requires-Dist: psycopg2-binary
19
24
 
20
25
  # GESTÃO DE BANCOS DE DADOS (MYSQL | SQLITE | POSTGRESQL)
@@ -1,3 +1,4 @@
1
1
  mysql-connector
2
2
  mysql-connector-python
3
+ psycopg2
3
4
  psycopg2-binary
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='manage-sql',
5
- version='0.5.4',
5
+ version='0.6.0.dev0826',
6
6
  author='Web Tech Moz',
7
7
  author_email='zoidycine@gmail.com',
8
8
  description='Biblioteca Python para gestão de bases de dados SQLite, MYSQL e PostgreSQL com maior eficiência',
@@ -13,13 +13,18 @@ setup(
13
13
  keywords=['manage-sql', 'sqlite', 'sqlite manager', 'mysql', 'mysql manager', 'mysql python', 'mysql connector', 'postgresql connector', 'postgresql', 'postgresql python'],
14
14
  license='MIT',
15
15
  classifiers=[
16
+ 'Programming Language :: Python :: 3.12',
17
+ 'Programming Language :: Python :: 3.11',
16
18
  'Programming Language :: Python :: 3.10',
19
+ 'Programming Language :: Python :: 3.7',
20
+ 'Programming Language :: Python :: 3.6',
17
21
  'License :: OSI Approved :: MIT License',
18
22
  'Operating System :: OS Independent',
19
23
  ],
20
24
  install_requires=[
21
25
  "mysql-connector",
22
26
  "mysql-connector-python",
27
+ "psycopg2",
23
28
  "psycopg2-binary"
24
29
  ],
25
30
  python_requires='>=3.6',
File without changes
File without changes
File without changes