dragon-ml-toolbox 10.10.0__py3-none-any.whl → 10.10.1__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.
Potentially problematic release.
This version of dragon-ml-toolbox might be problematic. Click here for more details.
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/METADATA +1 -1
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/RECORD +7 -7
- ml_tools/SQL.py +17 -7
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/WHEEL +0 -0
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/licenses/LICENSE +0 -0
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/licenses/LICENSE-THIRD-PARTY.md +0 -0
- {dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
dragon_ml_toolbox-10.10.
|
|
2
|
-
dragon_ml_toolbox-10.10.
|
|
1
|
+
dragon_ml_toolbox-10.10.1.dist-info/licenses/LICENSE,sha256=2uUFNy7D0TLgHim1K5s3DIJ4q_KvxEXVilnU20cWliY,1066
|
|
2
|
+
dragon_ml_toolbox-10.10.1.dist-info/licenses/LICENSE-THIRD-PARTY.md,sha256=lY4_rJPnLnMu7YBQaY-_iz1JRDcLdQzNCyeLAF1glJY,1837
|
|
3
3
|
ml_tools/ETL_cleaning.py,sha256=lSP5q6-ukGhJBPV8dlsqJvPXAzj4du_0J-SbtEd0Pjg,19292
|
|
4
4
|
ml_tools/ETL_engineering.py,sha256=a6KCWH6kRatZtjaFEF_o917ApPMK5_vRD-BjfCDAl-E,49400
|
|
5
5
|
ml_tools/GUI_tools.py,sha256=kEQWg-bog3pB5tI22gMGKWaCGHnz9TB2Lvvfhf5F2CI,45412
|
|
@@ -15,7 +15,7 @@ ml_tools/ML_scaler.py,sha256=h2ymq5u953Lx60Qb38Y0mAWj85x9PbnP0xYNQ3pd8-w,7535
|
|
|
15
15
|
ml_tools/ML_trainer.py,sha256=_g48w5Ak-wQr5fGHdJqlcpnzv3gWyL1ghkOhy9VOZbo,23930
|
|
16
16
|
ml_tools/PSO_optimization.py,sha256=q0VYpssQGbPum7xdnkDXlJQKhZMYZo8acHpKhajPK3c,22954
|
|
17
17
|
ml_tools/RNN_forecast.py,sha256=8rNZr-eWOBXMiDQV22e_tQTPM5LM2IFggEAa1FaoXaI,1965
|
|
18
|
-
ml_tools/SQL.py,sha256=
|
|
18
|
+
ml_tools/SQL.py,sha256=rPeKywvwJ5oHYVUQUovO3OUkXQTxBT9Dvwb6E2ntphY,11233
|
|
19
19
|
ml_tools/VIF_factor.py,sha256=MkMh_RIdsN2XUPzKNGRiEcmB17R_MmvGV4ezpL5zD2E,10403
|
|
20
20
|
ml_tools/__init__.py,sha256=q0y9faQ6e17XCQ7eUiCZ1FJ4Bg5EQqLjZ9f_l5REUUY,41
|
|
21
21
|
ml_tools/_logger.py,sha256=wcImAiXEZKPNcwM30qBh3t7HvoPURonJY0nrgMGF0sM,4719
|
|
@@ -30,7 +30,7 @@ ml_tools/keys.py,sha256=FDpbS3Jb0pjrVvvp2_8nZi919mbob_-xwuy5OOtKM_A,1848
|
|
|
30
30
|
ml_tools/optimization_tools.py,sha256=P3I6lIpvZ8Xf2kX5FvvBKBmrK2pB6idBpkTzfUJxTeE,5073
|
|
31
31
|
ml_tools/path_manager.py,sha256=wLJlz3Y9_1-LB9em4B2VYDCVuTOX2eOc7D6hbbebjgM,14990
|
|
32
32
|
ml_tools/utilities.py,sha256=30z0x1aDLyBGzF98_tgSaxwFafYwQS-GTFzXHopBSGc,29105
|
|
33
|
-
dragon_ml_toolbox-10.10.
|
|
34
|
-
dragon_ml_toolbox-10.10.
|
|
35
|
-
dragon_ml_toolbox-10.10.
|
|
36
|
-
dragon_ml_toolbox-10.10.
|
|
33
|
+
dragon_ml_toolbox-10.10.1.dist-info/METADATA,sha256=uwfI1-UU2czHm1VT4SoSZNrZur0DL2PWI23VUx9HaBM,6969
|
|
34
|
+
dragon_ml_toolbox-10.10.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
dragon_ml_toolbox-10.10.1.dist-info/top_level.txt,sha256=wm-oxax3ciyez6VoO4zsFd-gSok2VipYXnbg3TH9PtU,9
|
|
36
|
+
dragon_ml_toolbox-10.10.1.dist-info/RECORD,,
|
ml_tools/SQL.py
CHANGED
|
@@ -120,12 +120,14 @@ class DatabaseManager:
|
|
|
120
120
|
if not self.cursor:
|
|
121
121
|
_LOGGER.error("Database connection is not open.")
|
|
122
122
|
raise sqlite3.Error()
|
|
123
|
+
|
|
124
|
+
sanitized_table_name = sanitize_filename(table_name)
|
|
123
125
|
|
|
124
126
|
columns = ', '.join(f'"{k}"' for k in data.keys())
|
|
125
127
|
placeholders = ', '.join(['?'] * len(data))
|
|
126
128
|
values = list(data.values())
|
|
127
129
|
|
|
128
|
-
query = f
|
|
130
|
+
query = f'INSERT INTO "{sanitized_table_name}" ({columns}) VALUES ({placeholders})'
|
|
129
131
|
|
|
130
132
|
self.cursor.execute(query, values)
|
|
131
133
|
|
|
@@ -187,6 +189,8 @@ class DatabaseManager:
|
|
|
187
189
|
if not data:
|
|
188
190
|
_LOGGER.warning("'insert_many' called with empty data list. No action taken.")
|
|
189
191
|
return
|
|
192
|
+
|
|
193
|
+
sanitized_table_name = sanitize_filename(table_name)
|
|
190
194
|
|
|
191
195
|
# Assume all dicts have the same keys as the first one
|
|
192
196
|
first_row = data[0]
|
|
@@ -196,10 +200,10 @@ class DatabaseManager:
|
|
|
196
200
|
# Create a list of tuples, where each tuple is a row of values
|
|
197
201
|
values_to_insert = [list(row.values()) for row in data]
|
|
198
202
|
|
|
199
|
-
query = f
|
|
203
|
+
query = f'INSERT INTO "{sanitized_table_name}" ({columns}) VALUES ({placeholders})'
|
|
200
204
|
|
|
201
205
|
self.cursor.executemany(query, values_to_insert)
|
|
202
|
-
_LOGGER.info(f"➡️ Bulk inserted {len(values_to_insert)} rows into '{
|
|
206
|
+
_LOGGER.info(f"➡️ Bulk inserted {len(values_to_insert)} rows into '{sanitized_table_name}'.")
|
|
203
207
|
|
|
204
208
|
def insert_from_dataframe(self, table_name: str, df: pd.DataFrame, if_exists: Literal['fail', 'replace', 'append'] = 'append'):
|
|
205
209
|
"""
|
|
@@ -220,9 +224,11 @@ class DatabaseManager:
|
|
|
220
224
|
if not self.conn:
|
|
221
225
|
_LOGGER.error("Database connection is not open.")
|
|
222
226
|
raise sqlite3.Error()
|
|
227
|
+
|
|
228
|
+
sanitized_table_name = sanitize_filename(table_name)
|
|
223
229
|
|
|
224
230
|
df.to_sql(
|
|
225
|
-
|
|
231
|
+
sanitized_table_name,
|
|
226
232
|
self.conn,
|
|
227
233
|
if_exists=if_exists,
|
|
228
234
|
index=False # Typically, we don't want to save the DataFrame index
|
|
@@ -248,9 +254,11 @@ class DatabaseManager:
|
|
|
248
254
|
if not self.conn:
|
|
249
255
|
_LOGGER.error("Database connection is not open.")
|
|
250
256
|
raise sqlite3.Error()
|
|
257
|
+
|
|
258
|
+
sanitized_table_name = sanitize_filename(table_name)
|
|
251
259
|
|
|
252
260
|
# PRAGMA is a special SQL command in SQLite for database metadata
|
|
253
|
-
return pd.read_sql_query(f'PRAGMA table_info("{
|
|
261
|
+
return pd.read_sql_query(f'PRAGMA table_info("{sanitized_table_name}");', self.conn)
|
|
254
262
|
|
|
255
263
|
def create_index(self, table_name: str, column_name: str, unique: bool = False):
|
|
256
264
|
"""
|
|
@@ -269,11 +277,13 @@ class DatabaseManager:
|
|
|
269
277
|
if not self.cursor:
|
|
270
278
|
_LOGGER.error("Database connection is not open.")
|
|
271
279
|
raise sqlite3.Error()
|
|
280
|
+
|
|
281
|
+
sanitized_table_name = sanitize_filename(table_name)
|
|
272
282
|
|
|
273
|
-
index_name = f"idx_{
|
|
283
|
+
index_name = f"idx_{sanitized_table_name}_{column_name}"
|
|
274
284
|
unique_clause = "UNIQUE" if unique else ""
|
|
275
285
|
|
|
276
|
-
query = f
|
|
286
|
+
query = f'CREATE {unique_clause} INDEX IF NOT EXISTS "{index_name}" ON "{sanitized_table_name}" ("{column_name}")'
|
|
277
287
|
|
|
278
288
|
_LOGGER.info(f"➡️ Executing: {query}")
|
|
279
289
|
self.cursor.execute(query)
|
|
File without changes
|
{dragon_ml_toolbox-10.10.0.dist-info → dragon_ml_toolbox-10.10.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|