bbdd-utils 0.3.11__tar.gz → 0.3.13__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.11 → bbdd_utils-0.3.13}/PKG-INFO +1 -1
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils/utils.py +5 -12
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils.egg-info/PKG-INFO +1 -1
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/setup.py +1 -1
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/LICENSE +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/README.md +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils/__init__.py +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils.egg-info/SOURCES.txt +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils.egg-info/dependency_links.txt +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/bbdd_utils.egg-info/top_level.txt +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/pyproject.toml +0 -0
- {bbdd_utils-0.3.11 → bbdd_utils-0.3.13}/setup.cfg +0 -0
@@ -74,7 +74,6 @@ def Insert(conn, tabla, data):
|
|
74
74
|
if isinstance(conn, sqlite3.Connection):
|
75
75
|
print("Conexión exitosa a la base de datos SQL.")
|
76
76
|
cursor = conn.cursor()
|
77
|
-
|
78
77
|
# Crear la tabla dinámicamente si no existe
|
79
78
|
columnas_definicion = ", ".join([f"{col} TEXT" for col in columnas])
|
80
79
|
cursor.execute(f"""
|
@@ -85,18 +84,12 @@ def Insert(conn, tabla, data):
|
|
85
84
|
""")
|
86
85
|
print(f"Tabla '{tabla}' verificada o creada exitosamente.")
|
87
86
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# Inserta cada elemento de la lista en la tabla
|
92
|
-
for registro in data:
|
93
|
-
columnas = ", ".join(registro.keys())
|
94
|
-
valores = ", ".join(["?"] * len(registro))
|
95
|
-
query = f"INSERT INTO {tabla} ({columnas}) VALUES ({valores})"
|
96
|
-
cursor.execute(query, tuple(registro.values()))
|
87
|
+
# Inserta datos en la tabla
|
88
|
+
placeholders = ", ".join(["?" for _ in columnas])
|
89
|
+
cursor.execute(f"INSERT INTO {tabla} ({', '.join(columnas)}) VALUES ({placeholders})", valores)
|
97
90
|
conn.commit()
|
98
|
-
print("Datos insertados correctamente en
|
99
|
-
|
91
|
+
print(f"Datos insertados correctamente en la tabla '{tabla}' de la base de datos SQL.")
|
92
|
+
|
100
93
|
# Consulta los datos insertados
|
101
94
|
cursor.execute("SELECT * FROM {tabla}")
|
102
95
|
resultados = cursor.fetchall()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|