bbdd-utils 0.3.4__py3-none-any.whl → 0.3.6__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.
bbdd_utils/utils.py CHANGED
@@ -54,7 +54,7 @@ def Conector_bbdd(tipo='sqlite', nombre='mi_base_de_datos', host='localhost', pu
54
54
  cliente = MongoClient(host=host,
55
55
  port=puerto,
56
56
  username=usuario,
57
- password=contraseña)
57
+ password=password)
58
58
  print("Conectado a MongoDB")
59
59
  return cliente[nombre]
60
60
 
@@ -76,6 +76,8 @@ def Cerrar_conexion(conn):
76
76
 
77
77
  def Insert(conn, data):
78
78
  # Verifica el tipo de base de datos con la que estamos trabajando
79
+ ############# SQLite ################
80
+ import sqlite3
79
81
  if isinstance(conn, sqlite3.Connection):
80
82
  print("Conexión exitosa a la base de datos SQL.")
81
83
  # Si estamos usando SQLite, podemos trabajar con la conexión de esta manera
@@ -90,7 +92,8 @@ def Insert(conn, data):
90
92
  resultados = cursor.fetchall()
91
93
  for fila in resultados:
92
94
  print(f"ID: {fila[0]}, Nombre: {fila[1]}, Edad: {fila[2]}")
93
-
95
+
96
+ ############# MySQL ################
94
97
  elif isinstance(conn, mysql.connector.connection.MySQLConnection):
95
98
  print("Conexión exitosa a la base de datos MySQL.")
96
99
  # Si estamos usando MySQL, podemos trabajar con la conexión de esta manera
@@ -106,8 +109,7 @@ def Insert(conn, data):
106
109
  for fila in resultados:
107
110
  print(f"ID: {fila[0]}, Nombre: {fila[1]}, Edad: {fila[2]}")
108
111
 
109
-
110
-
112
+ ############# MongoDB ################
111
113
  elif isinstance(conn, Database):
112
114
  print("Conexión exitosa a la base de datos NoSQL.")
113
115
  print(conn)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bbdd_utils
3
- Version: 0.3.4
4
- Summary: actualizacion mysql y sqlite3
3
+ Version: 0.3.6
4
+ Summary: insertar datos en una base de datos SQL o NoSQL
5
5
  Author: Luis_J_Domingo
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
@@ -0,0 +1,7 @@
1
+ bbdd_utils/__init__.py,sha256=mjRX7GqWkOJq66KqghZ4MZE0Aai6R89LPeu1mjq4lD4,121
2
+ bbdd_utils/utils.py,sha256=5co6YUlI7tzx-pIqnVcCAU-H2kflv59NFetRs4aTCvk,4646
3
+ bbdd_utils-0.3.6.dist-info/licenses/LICENSE,sha256=D4uqg6QX0fapLNcdUznOuGaRIUPnypOdeE2zIyYq7xY,217
4
+ bbdd_utils-0.3.6.dist-info/METADATA,sha256=jPMMQDXf_iVe83GrdPIsOOPHSTtvU9wCfcQCidfdOWM,693
5
+ bbdd_utils-0.3.6.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
6
+ bbdd_utils-0.3.6.dist-info/top_level.txt,sha256=bBGkVkxnOw7tZ2zRcyCM3lgVgYo1hFbcmwkGdKAj9Gk,11
7
+ bbdd_utils-0.3.6.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- bbdd_utils/__init__.py,sha256=mjRX7GqWkOJq66KqghZ4MZE0Aai6R89LPeu1mjq4lD4,121
2
- bbdd_utils/utils.py,sha256=qVALkcC4iJs5U5pHxBwNwsG5uTvXgQaGdK4nf4CMvRE,4508
3
- bbdd_utils-0.3.4.dist-info/licenses/LICENSE,sha256=D4uqg6QX0fapLNcdUznOuGaRIUPnypOdeE2zIyYq7xY,217
4
- bbdd_utils-0.3.4.dist-info/METADATA,sha256=3Bgs1cQWsNMUl7exObGT31Uu3YRqgdKuvcj_m6jc5Gg,675
5
- bbdd_utils-0.3.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
6
- bbdd_utils-0.3.4.dist-info/top_level.txt,sha256=bBGkVkxnOw7tZ2zRcyCM3lgVgYo1hFbcmwkGdKAj9Gk,11
7
- bbdd_utils-0.3.4.dist-info/RECORD,,