rgwfuncs 0.0.110__py3-none-any.whl → 0.0.112__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.
- rgwfuncs/df_lib.py +12 -12
- {rgwfuncs-0.0.110.dist-info → rgwfuncs-0.0.112.dist-info}/METADATA +1 -1
- rgwfuncs-0.0.112.dist-info/RECORD +11 -0
- rgwfuncs-0.0.110.dist-info/RECORD +0 -11
- {rgwfuncs-0.0.110.dist-info → rgwfuncs-0.0.112.dist-info}/WHEEL +0 -0
- {rgwfuncs-0.0.110.dist-info → rgwfuncs-0.0.112.dist-info}/entry_points.txt +0 -0
- {rgwfuncs-0.0.110.dist-info → rgwfuncs-0.0.112.dist-info}/licenses/LICENSE +0 -0
- {rgwfuncs-0.0.110.dist-info → rgwfuncs-0.0.112.dist-info}/top_level.txt +0 -0
rgwfuncs/df_lib.py
CHANGED
@@ -315,7 +315,7 @@ def load_data_from_query(
|
|
315
315
|
preset: Optional[str] = None,
|
316
316
|
db_type: Optional[str] = None,
|
317
317
|
host: Optional[str] = None,
|
318
|
-
|
318
|
+
user: Optional[str] = None,
|
319
319
|
password: Optional[str] = None,
|
320
320
|
database: Optional[str] = None
|
321
321
|
) -> pd.DataFrame:
|
@@ -327,7 +327,7 @@ def load_data_from_query(
|
|
327
327
|
preset (Optional[str]): The name of the database preset in the .rgwfuncsrc file.
|
328
328
|
db_type (Optional[str]): The database type ('mssql', 'mysql', or 'clickhouse').
|
329
329
|
host (Optional[str]): Database host.
|
330
|
-
|
330
|
+
user (Optional[str]): Database username.
|
331
331
|
password (Optional[str]): Database password.
|
332
332
|
database (Optional[str]): Database name.
|
333
333
|
|
@@ -374,15 +374,15 @@ def load_data_from_query(
|
|
374
374
|
def validate_credentials(
|
375
375
|
db_type: str,
|
376
376
|
host: Optional[str] = None,
|
377
|
-
|
377
|
+
user: Optional[str] = None,
|
378
378
|
password: Optional[str] = None,
|
379
379
|
database: Optional[str] = None
|
380
380
|
) -> dict:
|
381
381
|
"""Validate credentials and return a credentials dictionary."""
|
382
382
|
required_fields = {
|
383
|
-
'mssql': ['host', '
|
384
|
-
'mysql': ['host', '
|
385
|
-
'clickhouse': ['host', '
|
383
|
+
'mssql': ['host', 'user', 'password'],
|
384
|
+
'mysql': ['host', 'user', 'password'],
|
385
|
+
'clickhouse': ['host', 'user', 'password', 'database']
|
386
386
|
}
|
387
387
|
if db_type not in required_fields:
|
388
388
|
raise ValueError(f"Unsupported db_type: {db_type}")
|
@@ -390,7 +390,7 @@ def load_data_from_query(
|
|
390
390
|
credentials = {
|
391
391
|
'db_type': db_type,
|
392
392
|
'host': host,
|
393
|
-
'
|
393
|
+
'user': user,
|
394
394
|
'password': password,
|
395
395
|
'database': database
|
396
396
|
}
|
@@ -400,7 +400,7 @@ def load_data_from_query(
|
|
400
400
|
return credentials
|
401
401
|
|
402
402
|
# Validate input parameters
|
403
|
-
all_credentials = [host,
|
403
|
+
all_credentials = [host, user, password, database]
|
404
404
|
if preset and any(all_credentials):
|
405
405
|
raise ValueError("Cannot specify both preset and direct credentials")
|
406
406
|
if not preset and not db_type:
|
@@ -417,7 +417,7 @@ def load_data_from_query(
|
|
417
417
|
credentials = validate_credentials(
|
418
418
|
db_type=db_type,
|
419
419
|
host=host,
|
420
|
-
|
420
|
+
user=user,
|
421
421
|
password=password,
|
422
422
|
database=database
|
423
423
|
)
|
@@ -425,7 +425,7 @@ def load_data_from_query(
|
|
425
425
|
# Query functions
|
426
426
|
def query_mssql(credentials: dict, query: str) -> pd.DataFrame:
|
427
427
|
server = credentials['host']
|
428
|
-
user = credentials['
|
428
|
+
user = credentials['user']
|
429
429
|
password = credentials['password']
|
430
430
|
database = credentials.get('database', '')
|
431
431
|
with pymssql.connect(server=server, user=user, password=password, database=database) as conn:
|
@@ -437,7 +437,7 @@ def load_data_from_query(
|
|
437
437
|
|
438
438
|
def query_mysql(credentials: dict, query: str) -> pd.DataFrame:
|
439
439
|
host = credentials['host']
|
440
|
-
user = credentials['
|
440
|
+
user = credentials['user']
|
441
441
|
password = credentials['password']
|
442
442
|
database = credentials.get('database', '')
|
443
443
|
with mysql.connector.connect(host=host, user=user, password=password, database=database) as conn:
|
@@ -449,7 +449,7 @@ def load_data_from_query(
|
|
449
449
|
|
450
450
|
def query_clickhouse(credentials: dict, query: str) -> pd.DataFrame:
|
451
451
|
host = credentials['host']
|
452
|
-
user = credentials['
|
452
|
+
user = credentials['user']
|
453
453
|
password = credentials['password']
|
454
454
|
database = credentials['database']
|
455
455
|
max_retries = 5
|
@@ -0,0 +1,11 @@
|
|
1
|
+
rgwfuncs/__init__.py,sha256=WafmLtqJRnQ7LWU7Son0inje75tF-m6qHJqrmCgiM84,1354
|
2
|
+
rgwfuncs/df_lib.py,sha256=lcKrMj8IpxWxnWkBFekWBQd9-Ed2nXTsHo57gTeATjE,85153
|
3
|
+
rgwfuncs/docs_lib.py,sha256=i63NzX-V8cGhikYdtkRGAEe2VcuwpXxDUyTRa9xI7l8,1972
|
4
|
+
rgwfuncs/interactive_shell_lib.py,sha256=YeJBW9YgH5Nv77ONdOyIKFgtf0ItXStdlKGN9GGf8bU,4228
|
5
|
+
rgwfuncs/str_lib.py,sha256=rfzRd7bOc0KQ7UxUN-J6yxY23pHEUHqerVR1u-TyIAY,10690
|
6
|
+
rgwfuncs-0.0.112.dist-info/licenses/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
|
7
|
+
rgwfuncs-0.0.112.dist-info/METADATA,sha256=m6mY9nOaQYzPpXJ1grlouqQ6JpQUYFLFK4cvxVpiZrA,42972
|
8
|
+
rgwfuncs-0.0.112.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
rgwfuncs-0.0.112.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
10
|
+
rgwfuncs-0.0.112.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
11
|
+
rgwfuncs-0.0.112.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
rgwfuncs/__init__.py,sha256=WafmLtqJRnQ7LWU7Son0inje75tF-m6qHJqrmCgiM84,1354
|
2
|
-
rgwfuncs/df_lib.py,sha256=RFCgVcx_NphJ4Q7O6tP8rplBcx1qA4xHtNyjS8lHStY,85209
|
3
|
-
rgwfuncs/docs_lib.py,sha256=i63NzX-V8cGhikYdtkRGAEe2VcuwpXxDUyTRa9xI7l8,1972
|
4
|
-
rgwfuncs/interactive_shell_lib.py,sha256=YeJBW9YgH5Nv77ONdOyIKFgtf0ItXStdlKGN9GGf8bU,4228
|
5
|
-
rgwfuncs/str_lib.py,sha256=rfzRd7bOc0KQ7UxUN-J6yxY23pHEUHqerVR1u-TyIAY,10690
|
6
|
-
rgwfuncs-0.0.110.dist-info/licenses/LICENSE,sha256=jLvt20gcUZYB8UOvyBvyKQ1qhYYhD__qP7ZDx2lPFkU,1062
|
7
|
-
rgwfuncs-0.0.110.dist-info/METADATA,sha256=nhEZlnLfErGyCrSsbBw-k4Ah5HZ49oiJpj1yqpZGD-k,42972
|
8
|
-
rgwfuncs-0.0.110.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
-
rgwfuncs-0.0.110.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
10
|
-
rgwfuncs-0.0.110.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
11
|
-
rgwfuncs-0.0.110.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|