datasourcelib 0.1.7__py3-none-any.whl → 0.1.8__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.
- datasourcelib/datasources/sql_source.py +16 -2
- {datasourcelib-0.1.7.dist-info → datasourcelib-0.1.8.dist-info}/METADATA +1 -1
- {datasourcelib-0.1.7.dist-info → datasourcelib-0.1.8.dist-info}/RECORD +6 -6
- {datasourcelib-0.1.7.dist-info → datasourcelib-0.1.8.dist-info}/WHEEL +0 -0
- {datasourcelib-0.1.7.dist-info → datasourcelib-0.1.8.dist-info}/licenses/LICENSE +0 -0
- {datasourcelib-0.1.7.dist-info → datasourcelib-0.1.8.dist-info}/top_level.txt +0 -0
|
@@ -2,9 +2,10 @@ from typing import Any, Dict, List, Optional
|
|
|
2
2
|
from datasourcelib.datasources.datasource_base import DataSourceBase
|
|
3
3
|
from datasourcelib.utils.logger import get_logger
|
|
4
4
|
from datasourcelib.utils.validators import require_keys
|
|
5
|
+
from datasourcelib.utils.aggregation import generate_grouped_summaries
|
|
5
6
|
import os
|
|
6
7
|
import pyodbc
|
|
7
|
-
|
|
8
|
+
import pandas as pd
|
|
8
9
|
|
|
9
10
|
logger = get_logger(__name__)
|
|
10
11
|
|
|
@@ -121,7 +122,20 @@ class SQLDataSource(DataSourceBase):
|
|
|
121
122
|
results: List[Dict[str, Any]] = []
|
|
122
123
|
for r in rows:
|
|
123
124
|
results.append({cols[i]: r[i] for i in range(len(cols))})
|
|
124
|
-
|
|
125
|
+
|
|
126
|
+
df = pd.DataFrame(results)
|
|
127
|
+
summaries = generate_grouped_summaries(
|
|
128
|
+
df=df,
|
|
129
|
+
aggregation_field=self.config.get("sql_aggregation_field"),
|
|
130
|
+
row_format=self.config.get("sql_aggregation_row_format"),
|
|
131
|
+
constants={"title": ""},
|
|
132
|
+
header_format=self.config.get("sql_aggregation_header_format"),
|
|
133
|
+
sort_by=self.config.get("sql_aggregation_sort_by"), # or a column/list if you want ordering
|
|
134
|
+
validate=True # ensures all placeholders exist
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
return summaries
|
|
138
|
+
|
|
125
139
|
finally:
|
|
126
140
|
try:
|
|
127
141
|
cur.close()
|
|
@@ -12,7 +12,7 @@ datasourcelib/datasources/datasource_types.py,sha256=jpm4f9n1l7X9aBD58Pbr9evXiCH
|
|
|
12
12
|
datasourcelib/datasources/dataverse_source.py,sha256=PTIWArl_rRMap5QfH8ST5kCewE0Ax1xPZ1vgSxeujpU,14080
|
|
13
13
|
datasourcelib/datasources/sharepoint_source - Copy.py,sha256=7V1c-zyvTo4IuPN_YMrKwLZFgbtipbP-mtunmXjOLJQ,17664
|
|
14
14
|
datasourcelib/datasources/sharepoint_source.py,sha256=t3rly2mVEI2qEDuUVqstck5ktkZW0BnF16Bke_NjPLI,23126
|
|
15
|
-
datasourcelib/datasources/sql_source.py,sha256=
|
|
15
|
+
datasourcelib/datasources/sql_source.py,sha256=pXs5UDAxRyRYuvw-zMNieJAZSqDndh6LlJy9GS6GoiY,7159
|
|
16
16
|
datasourcelib/datasources/sql_source_bkup.py,sha256=ntZjiFXpa7V797x7mAATJV0LH-g878VHuRw-QTxEe28,6372
|
|
17
17
|
datasourcelib/indexes/__init__.py,sha256=S8dz-lyxy1BTuDuLGRJNLrZD_1ku_FIUnDEm6HhMyT0,94
|
|
18
18
|
datasourcelib/indexes/azure_search_index.py,sha256=kznAz06UXgyT1Clqj6gRhnBQ5HFw40ZQHJElRFIcbRo,22115
|
|
@@ -29,8 +29,8 @@ datasourcelib/utils/exceptions.py,sha256=mgcDaW1k3VndgpMOwSm7NqgyRTvvE2a5ehn3x4f
|
|
|
29
29
|
datasourcelib/utils/file_reader.py,sha256=Zr0rwNTRWE6KeVJEXgTOPS1_JI74LiUSiX5-6qojmN0,7301
|
|
30
30
|
datasourcelib/utils/logger.py,sha256=Sl6lNlvubxtK9ztzyq7vjGVyA8_-pZ_ixpk5jfVsh6U,424
|
|
31
31
|
datasourcelib/utils/validators.py,sha256=fLgmRAb5OZSdMVlHu_n0RKJUDl-G8dI8JsRSfxIquh8,205
|
|
32
|
-
datasourcelib-0.1.
|
|
33
|
-
datasourcelib-0.1.
|
|
34
|
-
datasourcelib-0.1.
|
|
35
|
-
datasourcelib-0.1.
|
|
36
|
-
datasourcelib-0.1.
|
|
32
|
+
datasourcelib-0.1.8.dist-info/licenses/LICENSE,sha256=9S0AcKETmp9XOcC73jEjN7WSkuSWGFGreiBat6ONClo,1087
|
|
33
|
+
datasourcelib-0.1.8.dist-info/METADATA,sha256=NzIB4zUHZei5jADVk8zT4RvWrvlIAskqr_xd_DfmRGg,1199
|
|
34
|
+
datasourcelib-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
35
|
+
datasourcelib-0.1.8.dist-info/top_level.txt,sha256=wIwiwdIj8T9pAvE2TkGLUvT2oIi43C2vkkTKibUlv3U,14
|
|
36
|
+
datasourcelib-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|