data-factory-utils 3.2.2__tar.gz → 3.3.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: data-factory-utils
3
- Version: 3.2.2
3
+ Version: 3.3.0
4
4
  Summary: Utility functions for interacting with data factories.
5
5
  Requires-Dist: boto3>=1.42.8
6
6
  Requires-Dist: boto3-stubs>=1.42.89
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "data-factory-utils"
3
- version = "3.2.2"
3
+ version = "3.3.0"
4
4
  description = "Utility functions for interacting with data factories."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "data-factory-utils"
3
- version = "3.2.2"
3
+ version = "3.3.0"
4
4
  description = "Utility functions for interacting with data factories."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -200,24 +200,23 @@ class AthenaQuery:
200
200
  # Get the raw query results from the API
201
201
  responses = self._get_responses()
202
202
 
203
- # Parse the raw row data from the results
204
- rows = []
203
+ column_names: list[str | None] | None = None
204
+ columns: list[list[str | None]] = []
205
+
205
206
  for response in responses:
206
207
  for row in response["ResultSet"]["Rows"]:
207
208
  row_data = [column.get("VarCharValue") for column in row["Data"]]
208
- rows.append(row_data)
209
-
210
- if len(rows) == 0:
211
- return pl.DataFrame({})
212
209
 
213
- # The first row returned by the response is the names of the columns.
214
- column_names, values_in_rows = rows[0], rows[1:]
210
+ # The first row returned by the response is the names of the columns.
211
+ if column_names is None:
212
+ column_names = row_data
213
+ columns = [[] for _ in column_names]
214
+ continue
215
215
 
216
- if len(values_in_rows) == 0:
217
- return pl.DataFrame(data={col: [] for col in column_names})
216
+ for column, value in zip(columns, row_data, strict=True):
217
+ column.append(value)
218
218
 
219
- # Convert a list of rows into a list of columns
220
- values_in_columns = list(zip(*values_in_rows, strict=True))
219
+ if column_names is None:
220
+ return pl.DataFrame({})
221
221
 
222
- # Package it up into a dictionary of columns
223
- return pl.DataFrame(dict(zip(column_names, values_in_columns, strict=True)))
222
+ return pl.DataFrame(dict(zip(column_names, columns, strict=True)))