bbdd-utils 0.3.13__tar.gz → 0.3.15__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.
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/PKG-INFO +1 -1
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils/utils.py +4 -6
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils.egg-info/PKG-INFO +1 -1
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/setup.py +1 -1
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/LICENSE +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/README.md +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils/__init__.py +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils.egg-info/SOURCES.txt +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils.egg-info/dependency_links.txt +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/bbdd_utils.egg-info/top_level.txt +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/pyproject.toml +0 -0
- {bbdd_utils-0.3.13 → bbdd_utils-0.3.15}/setup.cfg +0 -0
@@ -18,7 +18,9 @@ def Conector_bbdd(tipo='sqlite', nombre='mi_base_de_datos', host='localhost', pu
|
|
18
18
|
import os
|
19
19
|
nombre_db = f"{nombre}.db"
|
20
20
|
conn = sqlite3.connect(nombre_db)
|
21
|
+
print(f"Base de datos SQLite '{nombre_db}' creada exitosamente.")
|
21
22
|
return conn
|
23
|
+
|
22
24
|
|
23
25
|
elif tipo == 'mysql':
|
24
26
|
import mysql.connector
|
@@ -30,7 +32,7 @@ def Conector_bbdd(tipo='sqlite', nombre='mi_base_de_datos', host='localhost', pu
|
|
30
32
|
# Crear la base de datos
|
31
33
|
cursor = conn.cursor()
|
32
34
|
cursor.execute(f"CREATE DATABASE IF NOT EXISTS {nombre}")
|
33
|
-
print(f"Base de datos '{nombre}' creada exitosamente.")
|
35
|
+
print(f"Base de datos Mysql '{nombre}' creada exitosamente.")
|
34
36
|
return conn
|
35
37
|
|
36
38
|
elif tipo == 'mongodb':
|
@@ -41,7 +43,7 @@ def Conector_bbdd(tipo='sqlite', nombre='mi_base_de_datos', host='localhost', pu
|
|
41
43
|
port=puerto,
|
42
44
|
username=usuario,
|
43
45
|
password=password)
|
44
|
-
print("
|
46
|
+
print(f"Conexión exitosa a MongoDB en {host}:{puerto}.")
|
45
47
|
return cliente[nombre]
|
46
48
|
|
47
49
|
else:
|
@@ -66,10 +68,6 @@ def Insert(conn, tabla, data):
|
|
66
68
|
import mysql.connector
|
67
69
|
from pymongo.database import Database
|
68
70
|
|
69
|
-
# Extraer las claves y valores del diccionario
|
70
|
-
columnas = data.keys()
|
71
|
-
valores = tuple(data.values())
|
72
|
-
|
73
71
|
############# SQLite ################
|
74
72
|
if isinstance(conn, sqlite3.Connection):
|
75
73
|
print("Conexión exitosa a la base de datos SQL.")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|