dynamicio 9.2.1rc2__tar.gz → 9.2.2__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.
Files changed (164) hide show
  1. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/workflows/build_and_publish.yml +18 -0
  2. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/AGENTS.md +3 -0
  3. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/CHANGELOG.md +5 -1
  4. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/PKG-INFO +94 -1
  5. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/core.py +6 -1
  6. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/with_athena.py +2 -2
  7. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/with_local.py +10 -7
  8. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/with_postgres.py +3 -2
  9. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/with_s3.py +19 -24
  10. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/pyproject.toml +17 -3
  11. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_athena_mixin.py +12 -0
  12. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_postgres_mixins.py +20 -0
  13. dynamicio-9.2.2/tests/test_mixins/test_reusable_io.py +239 -0
  14. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_s3_mixins.py +46 -13
  15. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.claude/skills/create-pr/SKILL.md +0 -0
  16. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.coveragerc +0 -0
  17. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.flake8 +0 -0
  18. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/CODEOWNERS +0 -0
  19. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  20. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  21. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/dependabot.yml +0 -0
  22. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/pull_request_template.md +0 -0
  23. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.github/workflows/pr_title_checker.yml +0 -0
  24. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.gitignore +0 -0
  25. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.gitlint +0 -0
  26. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.pre-commit-config.yaml +0 -0
  27. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.pylintrc +0 -0
  28. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.python-version +0 -0
  29. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/.yamllint +0 -0
  30. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/CONTRIBUTING.md +0 -0
  31. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/LICENSE +0 -0
  32. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/Makefile +0 -0
  33. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/README.md +0 -0
  34. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/catalog-info.yaml +0 -0
  35. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/__init__.py +0 -0
  36. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/definitions/input.yaml +0 -0
  37. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/definitions/processed.yaml +0 -0
  38. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/definitions/raw.yaml +0 -0
  39. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/schemas/input/bar.yaml +0 -0
  40. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/schemas/input/events.yaml +0 -0
  41. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/schemas/input/foo.yaml +0 -0
  42. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/schemas/processed/final_bar.yaml +0 -0
  43. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/resources/schemas/processed/final_foo.yaml +0 -0
  44. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/__init__.py +0 -0
  45. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/__main__.py +0 -0
  46. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/constants.py +0 -0
  47. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/environment.py +0 -0
  48. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/io.py +0 -0
  49. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/runner_selection.py +0 -0
  50. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/runners/__init__.py +0 -0
  51. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/runners/staging.py +0 -0
  52. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/src/runners/transform.py +0 -0
  53. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/__init__.py +0 -0
  54. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/conftest.py +0 -0
  55. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/constants.py +0 -0
  56. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/input/bar.parquet +0 -0
  57. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/input/events/part_2026.parquet +0 -0
  58. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/input/foo.csv +0 -0
  59. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/processed/expected/final_bar.parquet +0 -0
  60. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/processed/expected/final_foo.parquet +0 -0
  61. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/raw/expected/staged_bar.parquet +0 -0
  62. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/data/raw/expected/staged_foo.parquet +0 -0
  63. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/runners/__init__.py +0 -0
  64. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/runners/conftest.py +0 -0
  65. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/runners/test_staging.py +0 -0
  66. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/runners/test_transform.py +0 -0
  67. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/test_pipeline.py +0 -0
  68. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/test_prefix_schema_evolution.py +0 -0
  69. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/demo/tests/test_runner_selection.py +0 -0
  70. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/adr/0001-direct-boto3-s3-io.md +0 -0
  71. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/adr/0002-tolerate-missing-columns-in-parquet-prefix-reads.md +0 -0
  72. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/adr/0003-athena-via-aws-wrangler.md +0 -0
  73. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/adr/0004-ranged-parquet-reads-with-filters.md +0 -0
  74. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/adr/README.md +0 -0
  75. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/api.md +0 -0
  76. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/data-types.png +0 -0
  77. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/logo-original.png +0 -0
  78. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/logo-transparent.png +0 -0
  79. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/perf-awswrangler-vs-awscli/chart_read.png +0 -0
  80. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/perf-awswrangler-vs-awscli/chart_read_correction.png +0 -0
  81. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/perf-awswrangler-vs-awscli/chart_write.png +0 -0
  82. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/perf-pipeline-run/pipeline-task-delta.png +0 -0
  83. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/sample-pipeline.png +0 -0
  84. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/supported_sources.png +0 -0
  85. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/images/wrapped-panda.png +0 -0
  86. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/index.md +0 -0
  87. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/docs/perf-s3-io.md +0 -0
  88. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/__init__.py +0 -0
  89. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/__main__.py +0 -0
  90. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/animals.py +0 -0
  91. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/cli.py +0 -0
  92. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/__init__.py +0 -0
  93. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/io_config.py +0 -0
  94. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/pydantic/__init__.py +0 -0
  95. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/pydantic/config.py +0 -0
  96. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/pydantic/io_resources.py +0 -0
  97. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/config/pydantic/table_schema.py +0 -0
  98. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/errors.py +0 -0
  99. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/metrics.py +0 -0
  100. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/__init__.py +0 -0
  101. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/utils.py +0 -0
  102. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/mixins/with_kafka.py +0 -0
  103. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/py.typed +0 -0
  104. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/dynamicio/validations.py +0 -0
  105. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/mkdocs.yaml +0 -0
  106. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/__init__.py +0 -0
  107. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/conftest.py +0 -0
  108. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/constants.py +0 -0
  109. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/mocking/__init__.py +0 -0
  110. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/mocking/io.py +0 -0
  111. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/mocking/models.py +0 -0
  112. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/external/h5_with_more_columns.h5 +0 -0
  113. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/external/json_with_more_columns.json +0 -0
  114. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/hdf/part_01.h5 +0 -0
  115. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/hdf/part_02.h5 +0 -0
  116. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_hdf/part_01.h5 +0 -0
  117. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_hdf/part_02.h5 +0 -0
  118. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_hdf/something_to_ignore.txt +0 -0
  119. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_parquet/part_01.parquet +0 -0
  120. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_parquet/part_02.parquet +0 -0
  121. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/not_just_parquet/something_to_ignore.txt +0 -0
  122. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/dynamic/dir_01/part_01.parquet +0 -0
  123. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/dynamic/dir_01/part_02.parquet +0 -0
  124. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/dynamic/dir_02/part_01.parquet +0 -0
  125. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/dynamic/dir_02/part_02.parquet +0 -0
  126. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/part_01.parquet +0 -0
  127. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet/part_02.parquet +0 -0
  128. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet_w_empty_files/emptyfile.parquet +0 -0
  129. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/batch/parquet_w_empty_files/fullfile.parquet +0 -0
  130. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/multi_row_json.json +0 -0
  131. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/single_row_json.json +0 -0
  132. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/some_csv_to_read.csv +0 -0
  133. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/some_hdf_to_read.h5 +0 -0
  134. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/some_json_to_read.json +0 -0
  135. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/some_parquet_to_read.parquet +0 -0
  136. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/input/some_pg_parquet_to_read.parquet +0 -0
  137. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/processed/.gitkeep +0 -0
  138. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/data/temp/.gitkeep +0 -0
  139. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/definitions/external.yaml +0 -0
  140. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/definitions/input.yaml +0 -0
  141. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/definitions/processed.yaml +0 -0
  142. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/definitions/test_input.yaml +0 -0
  143. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/bar.yaml +0 -0
  144. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/foo.yaml +0 -0
  145. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/pg.yaml +0 -0
  146. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/read_from_s3_csv.yaml +0 -0
  147. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/some_csv_to_read.yaml +0 -0
  148. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/some_hdf_to_read.yaml +0 -0
  149. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/some_json_to_read.yaml +0 -0
  150. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/some_parquet_to_read.yaml +0 -0
  151. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/some_pg_parquet_to_read.yaml +0 -0
  152. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/resources/schemas/write_to_s3_csv.yaml +0 -0
  153. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_cli.py +0 -0
  154. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_config.py +0 -0
  155. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_core.py +0 -0
  156. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_errors.py +0 -0
  157. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_metrics.py +0 -0
  158. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/__init__.py +0 -0
  159. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_kafka_mixins.py +0 -0
  160. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_local_mixins.py +0 -0
  161. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_mixins/test_utils.py +0 -0
  162. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_table_schema.py +0 -0
  163. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/tests/test_validations.py +0 -0
  164. {dynamicio-9.2.1rc2 → dynamicio-9.2.2}/uv.lock +0 -0
@@ -122,6 +122,8 @@ jobs:
122
122
  if: startsWith(github.ref, 'refs/tags/v')
123
123
  needs: ["style-checks", "test", "dependency-ranges"]
124
124
  runs-on: ubuntu-latest
125
+ permissions:
126
+ contents: write # to create the GitHub release
125
127
  steps:
126
128
  - uses: actions/checkout@v4
127
129
  with:
@@ -133,6 +135,14 @@ jobs:
133
135
  python-version: "3.10"
134
136
  enable-cache: true
135
137
 
138
+ - name: Check that CHANGELOG.md has a section for this release
139
+ if: ${{ !contains(github.ref_name, '-rc') }}
140
+ run: |
141
+ if ! grep -qx "## ${GITHUB_REF_NAME}" CHANGELOG.md; then
142
+ echo "CHANGELOG.md has no '## ${GITHUB_REF_NAME}' heading: rename '## Unreleased' in the release PR and tag the merge commit" >&2
143
+ exit 1
144
+ fi
145
+
136
146
  - name: Build and Publish to PyPI
137
147
  env:
138
148
  PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
@@ -140,3 +150,11 @@ jobs:
140
150
  uv build
141
151
  uv publish --token "$PYPI_TOKEN"
142
152
 
153
+
154
+ - name: Create the GitHub release from the CHANGELOG section
155
+ if: ${{ !contains(github.ref_name, '-rc') }}
156
+ env:
157
+ GH_TOKEN: ${{ github.token }}
158
+ run: |
159
+ awk -v tag="## ${GITHUB_REF_NAME}" '$0 == tag {on=1; next} /^## /{on=0} on' CHANGELOG.md > notes.md
160
+ gh release create "$GITHUB_REF_NAME" --verify-tag --title "$GITHUB_REF_NAME" --notes-file notes.md
@@ -88,6 +88,9 @@ Do not publish a release candidate just to test locally. Release candidates are
88
88
  - Tag from **master after the PR is merged** (or an rc from the feature branch), and tag an explicit commit sha:
89
89
  `git tag -a vX.Y.Z <sha> -m "..."` then `git push origin vX.Y.Z`. Check `git pull` actually succeeded first; a failed pull
90
90
  silently tags a stale commit.
91
+ - The tag must carry its changelog. Release PR (the only change in it): rename `## Unreleased` in `CHANGELOG.md` to `## vX.Y.Z`. Tag the merge commit.
92
+ CI fails a final tag without a `## vX.Y.Z` heading, publishes README + CHANGELOG as the PyPI description (`hatch-fancy-pypi-readme`) and
93
+ creates the GitHub release with that section as notes. Release candidates skip these checks.
91
94
  - Do not merge pull requests or publish a final release unless the maintainer asked you to; open the PR and hand over.
92
95
 
93
96
  ## Conventions
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## v9.2.2
4
+
5
+ - fix: an IO object can be read or written repeatedly. A read or write removed values from `self.options`, so a second call on the same object failed or read the wrong data. The second call of a path with template fields (for example `{runner_id}`) raised `ValueError: Expected values for all fields`. Three cases gave no error. The S3 path-prefix read removed `no_disk_space`. The Athena read removed `query`, and the Postgres read removed `sql_query`, so the second read ran the default query and returned wrong data. Each call now works on a copy of the options, and `self.options` does not change. The two private methods `WithS3._read_parquet_object` and `WithS3._concat_parquet_objects` are removed. The module-level functions with the same names are unchanged
6
+
7
+ ## v9.2.1
4
8
 
5
9
  - fix: transient S3 connection errors no longer fail a read or write. The shared boto3 client now uses the `standard` retry mode with 10 attempts, `connect_timeout=10` and `read_timeout=60`. The in-memory and file transfers (`put_object`, `upload_fileobj`, `get_object`, `download_fileobj`) are repeated, up to 5 attempts with backoff, on `ConnectionClosedError`, `ConnectTimeoutError`, `EndpointConnectionError`, `ReadTimeoutError`, `IncompleteReadError`, `ResponseStreamingError` and the `RetriesExceededError` that the transfer manager raises (s3transfer's and boto3's) when a download above 16 MiB gave up on a broken part. botocore does not retry these once the body is being sent or read. The buffer is rewound before each attempt (bytes written are identical), each retry is logged at WARNING with the bucket and key, and the shared client is rebuilt so the next attempt opens fresh connections. Other errors (for example `ClientError`) are raised as before, and nothing changes when no error occurs
6
10
 
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dynamicio
3
- Version: 9.2.1rc2
3
+ Version: 9.2.2
4
4
  Summary: Panda's wrapper for IO operations
5
+ Project-URL: Changelog, https://github.com/VorTECHsa/dynamicio/blob/master/CHANGELOG.md
5
6
  Author-email: Christos Hadjinikolis <christos.hadjinikolis@gmail.com>, Radu Ghitescu <radu.ghitescu@gmail.com>
6
7
  License-Expression: Apache-2.0
7
8
  License-File: LICENSE
@@ -1253,3 +1254,95 @@ Hope this was helpful.
1253
1254
 
1254
1255
  Please do reach out with comments and your views about how the library or the docs can be improved, and by all means, come along and contribute to our project!
1255
1256
 
1257
+
1258
+
1259
+ # Changelog
1260
+
1261
+ ## v9.2.2
1262
+
1263
+ - fix: an IO object can be read or written repeatedly. A read or write removed values from `self.options`, so a second call on the same object failed or read the wrong data. The second call of a path with template fields (for example `{runner_id}`) raised `ValueError: Expected values for all fields`. Three cases gave no error. The S3 path-prefix read removed `no_disk_space`. The Athena read removed `query`, and the Postgres read removed `sql_query`, so the second read ran the default query and returned wrong data. Each call now works on a copy of the options, and `self.options` does not change. The two private methods `WithS3._read_parquet_object` and `WithS3._concat_parquet_objects` are removed. The module-level functions with the same names are unchanged
1264
+
1265
+ ## v9.2.1
1266
+
1267
+ - fix: transient S3 connection errors no longer fail a read or write. The shared boto3 client now uses the `standard` retry mode with 10 attempts, `connect_timeout=10` and `read_timeout=60`. The in-memory and file transfers (`put_object`, `upload_fileobj`, `get_object`, `download_fileobj`) are repeated, up to 5 attempts with backoff, on `ConnectionClosedError`, `ConnectTimeoutError`, `EndpointConnectionError`, `ReadTimeoutError`, `IncompleteReadError`, `ResponseStreamingError` and the `RetriesExceededError` that the transfer manager raises (s3transfer's and boto3's) when a download above 16 MiB gave up on a broken part. botocore does not retry these once the body is being sent or read. The buffer is rewound before each attempt (bytes written are identical), each retry is logged at WARNING with the bucket and key, and the shared client is rebuilt so the next attempt opens fresh connections. Other errors (for example `ClientError`) are raised as before, and nothing changes when no error occurs
1268
+
1269
+ ## v9.2.0
1270
+
1271
+ - feat: a single-file S3 parquet read with `filters` reads only the row groups whose footer statistics can match, over ranged `GetObject` requests through `pyarrow.fs.S3FileSystem` (one for each process and bucket). The rows, index and dtypes are the same as before. Reads without `filters` or with `filters=[]`, fastparquet reads, reads with a non-pyarrow `filesystem`, prefix reads and reads with wrangler-only kwargs do not change. On the ranged read, a missing key or a permission problem raises pyarrow `FileNotFoundError` or `OSError` in place of botocore `ClientError`, and a custom S3 endpoint of boto3 (`AWS_ENDPOINT_URL`) does not apply. See ADR 0004
1272
+ - feat: new postgres write option `create_table` (default `False`). When `True`, the writer creates a missing table from the schema columns, with no primary key and with unbounded string columns, in the same transaction as the write. The postgres writer now lists its options (`truncate_and_append`, `create_table`), so it drops other options with a warning, as the other writers do. A `create_table` value that is not a bool (for example the YAML string `"false"`) raises `TypeError`
1273
+ - fix: the cache of pyarrow S3 file systems is cleared at exit, before the pyarrow S3 finalizer runs. With pyarrow 24 and later, a process that read with `filters` on a pod with web identity credentials did not exit (https://github.com/apache/arrow/issues/50188)
1274
+ - chore: dev dependency `moto[server]>=5` for the tests of the ranged read
1275
+
1276
+ ## v9.1.0
1277
+
1278
+ - chore(deps): dependency audit, ranges widened to what the code needs and CI proves. Removed packages the code never imports (`fsspec`, `libcst`, `logzero`, `no_implicit_optional`); dropped exact pins (`confluent-kafka>=2.4.0,<3`, `psycopg2-binary>=2.9.3,<3`, `python-json-logger>=2.0.1`, `simplejson>=3.17.2`); lifted the `numpy<2` ceiling (numpy 2.x passes the suite) and the `python<3.13` ceiling (3.13 and 3.14 pass; added to CI and classifiers). Raised floors so every allowed combination works with numpy 2 as well as numpy 1: `pandas>=2.2.2` (JSON writes with `index=False` for `records`/`values`, relied on since 8.1.1, need pandas 2.1, and pandas before 2.2.2 breaks with numpy 2), `pyarrow>=16.0.0`, `fastparquet>=2024.5.0`, `awswrangler>=3.9.0` (older ones cannot import against numpy 2 or pyarrow 16), `PyYAML>=6.0` (5.4.1 does not build with current toolchains). New CI job `dependency-ranges` tests the minimums (Python 3.10), the minimums with numpy 2 (Python 3.11) and the newest releases (Python 3.14); publishing waits for it
1279
+ - fix: `python-json-logger` 3.1+ import path (`pythonjsonlogger.json`) with fallback to the old module, avoiding a `DeprecationWarning` on import
1280
+
1281
+ ## v9.0.0
1282
+
1283
+ **Breaking:** Athena resources must rename `s3_staging_dir` to `s3_output` (see the first Athena entry below).
1284
+
1285
+ - docs: add Backstage `catalog-info.yaml` to enable TechDocs
1286
+ - docs: README documents Athena I/O (resource options, `ctas_approach`, dtypes, `s3_staging_dir` migration); ADR 0003
1287
+ - chore: migrate project and dependency management from Poetry to uv (PEP 621 `pyproject.toml`, `uv.lock`, `hatchling` + `hatch-vcs` build backend). The version is still derived from the git tag and the published wheel is unchanged apart from standard metadata. Contributors now use `make dev-env-setup` / `uv sync`; see `CONTRIBUTING.md` and `AGENTS.md`
1288
+ - feat(RND-13624)!: `WithAthena` reads through AWS Data Wrangler (`wr.athena.read_sql_query`) instead of PyAthena, and the `pyathena` dependency is dropped. **Breaking (resource definitions):** the `s3_staging_dir` key of an `athena:` section is removed. Loading such a definition now fails with an error saying to rename it to `s3_output` (same value); nothing else changes in the YAML. `region_name` and `query` stay optional, and `database` (default `default`, Athena's own default) and `workgroup` are new optional keys. Reads use the shared per-process boto3 session unless `region_name` is set. Extra `options` are filtered to what `read_sql_query` accepts (e.g. `ctas_approach`, `unload_approach`, `athena_cache_settings`); `chunksize` is rejected with an error, because a chunked read returns an iterator rather than a DataFrame
1289
+ - `ctas_approach` defaults to `False` (as PyAthena, which read the query's result file): column names keep the case used in the query (CTAS lower-cases them) and no temporary Glue table is created. Pass `ctas_approach: true` in `options` to opt in for large results
1290
+ - note: results now come back with pandas nullable dtypes (`Int64`, `string`, `boolean`) and `date` as Python dates, as returned by awswrangler; declare the dtypes in the resource schema to cast them on read, as for any other source
1291
+
1292
+ ## v8.1.1
1293
+
1294
+ - fix: S3 JSON reads and writes use pandas' defaults again: `lines=False` (a JSON array for `orient="records"`, as written by 7.x and earlier) unless the caller passes `lines`. 8.1.0 defaulted to JSON Lines for `orient="records"`, which could not read existing files and wrote files that 7.x readers cannot parse. Set `lines: true` in the resource `options` to opt in to JSON Lines
1295
+ - fix: S3 JSON writes default `index` per orient as pandas does (`True` for `index`/`columns`/`split`/`table`, `False` for `records`/`values`) instead of always `False`, which made `orient="index"` and `orient="columns"` writes fail or drop the index
1296
+
1297
+ ## v8.1.0-rc.11
1298
+
1299
+ - fix: an `s3_file` parquet source whose `file_path` ends in `/` (a directory of parquet objects, e.g. a downstream pipeline's outcome dataset) is read as a dataset again: all objects under it are concatenated in listing order, with the same missing-column tolerance as `s3_path_prefix`. Since rc.7 it failed with `NoSuchKey` because the single-file reader issued a `GetObject` on the `.../` key
1300
+
1301
+ ## v8.1.0-rc.10
1302
+
1303
+ - fix: S3 CSV writes accept a caller-supplied `index` option (`TypeError: to_csv() got multiple values for keyword argument 'index'` since rc.1, hit by a downstream pipeline's `IO(..., index=False)`), and default to `index=True` like `DataFrame.to_csv` and the s3fs writer on master, instead of the hard-coded `index=False` of the wrangler writer
1304
+ - fix: the awswrangler parquet fallback tolerates a caller-supplied `dataset` option instead of raising a duplicate-keyword `TypeError`
1305
+
1306
+ ## v8.1.0-rc.9
1307
+
1308
+ - perf: parquet `no_disk_space` prefix reads use the same in-memory thread pool as the default path (~4x faster on a 3.7M-row prefix, 199s to 46s, lower peak memory); rows, order and dtypes unchanged
1309
+ - fix: parquet prefix reads return rows in S3 listing order and null-filled object columns hold `None`, as `master`'s `no_disk_space` dataset read did (see rc.8 notes)
1310
+
1311
+ ## v8.1.0-rc.8
1312
+
1313
+ - perf: parquet `WithS3PathPrefix` reads fetch and parse each object in memory on the download threads (no temp dir, parsing overlaps the network); ~15% faster on ~1000 files over WAN, same rows. Files are now concatenated in listing order instead of arbitrary `os.listdir` order
1314
+ - fix: `WithS3PathPrefix` parquet reads no longer fail with `ArrowInvalid: No match for FieldRef.Name(<col>)` when some objects under the prefix predate a schema column. Such objects get nulls for that column (as master's `no_disk_space` dataset read did when the first listed file had the column), a warning lists the columns and how many objects lacked them, and a column missing from every object still raises `ValueError`
1315
+ - fix: parquet `no_disk_space` prefix reads return rows in S3 listing order again, as `master` did (the branch had reversed it); null-filled object columns hold `None` like `master`'s dataset read, not `NaN`
1316
+ - fix: `WithPostgres` logged `Started downloading table` twice per read (the query itself ran once); now logged once
1317
+
1318
+ ## v8.1.0-rc.7
1319
+
1320
+ (rc.5 and rc.6 were tagged but never published: black/pylint/flake8 style checks failed. Contents are identical apart from formatting.)
1321
+
1322
+ - perf: reuse one boto3 session/client per process (fork-safe) instead of building a new one per awswrangler call
1323
+ - perf: single-file S3 parquet reads/writes use one `GetObject`/`PutObject` over the shared client and parse in memory with the same pandas/pyarrow options as local I/O; awswrangler is only used when a wrangler-only option is passed (fixes the ~2.6x read slowdown seen in rc.1-rc.4)
1324
+ - feat!: remove `awscli` and `s3fs` dependencies; `WithS3PathPrefix` now syncs with a boto3 thread pool (one request per file, concurrency 32) instead of the in-process `aws s3 sync`. No `aws` console script is installed into consumer venvs any more
1325
+ - fix: S3 HDF writer honours `pickle_protocol`
1326
+ - fix: S3 JSON reader supports `single_record`
1327
+
1328
+ ## v8.1.0-rc.4
1329
+
1330
+ - fix: stop forcing `convert_dates=False` on local JSON reads, letting pandas' own date auto-detection run unless the caller opts out explicitly (fixes datetime dtype regression for consumers relying on auto-parsed dates, e.g. reference-data JSON)
1331
+
1332
+ ## v8.1.0-rc.3
1333
+
1334
+ - fix: honor caller-supplied `orient`/`lines` for S3 and local JSON reads/writes instead of hardcoding `orient="records"` (fixes regression for consumers using `orient="index"`, e.g. reference-data JSON)
1335
+ - fix: re-apply popped `orient`/`lines` options before `df.to_json` in the local JSON writer (previously silently discarded)
1336
+
1337
+ ## v8.1.0-rc.2
1338
+
1339
+ - fix: stop forcing records-only orient on local JSON reads
1340
+
1341
+ ## v8.1.0-rc.1
1342
+
1343
+ - feat(RND-13624): Migrate `WithS3File` to AWS Data Wrangler
1344
+ - fix: address Copilot review findings on WithS3File wrangler migration
1345
+ - fix: silence pre-existing pylint invalid-name warnings to unblock style-checks
1346
+ - fix: satisfy black formatting and 90% coverage gate in CI
1347
+ - fix: regenerate poetry.lock to match pyproject.toml
1348
+ - docs: add awswrangler vs AWS CLI performance report, PR template, and skills
@@ -278,7 +278,7 @@ class DynamicDataIO:
278
278
  """
279
279
  dtypes = df.dtypes
280
280
 
281
- cols_allowed, cols_not_allowed = self._split_columns_to_validate_between_allowed_and_not(columns_to_validate=self.options.get("columns", self.schema.column_names))
281
+ cols_allowed, cols_not_allowed = self._split_columns_to_validate_between_allowed_and_not(columns_to_validate=self._columns_to_validate())
282
282
  if cols_not_allowed:
283
283
  logger.exception(f"The columns passed: {cols_not_allowed} do not belong to the schema")
284
284
  return False
@@ -306,6 +306,11 @@ class DynamicDataIO:
306
306
 
307
307
  return True
308
308
 
309
+ def _columns_to_validate(self) -> List[str]:
310
+ # A string `columns` is a path template field (for example `data/{columns}.parquet`), not a column selection
311
+ columns = self.options.get("columns")
312
+ return self.schema.column_names if columns is None or isinstance(columns, str) else columns
313
+
309
314
  def _split_columns_to_validate_between_allowed_and_not(self, columns_to_validate: List[str]) -> Tuple[List[SchemaColumn], List[str]]:
310
315
  not_allowed_cols, allowed_cols = [], []
311
316
  for col in columns_to_validate:
@@ -47,11 +47,11 @@ class WithAthena:
47
47
  resource schema to have them cast on read.
48
48
  """
49
49
  cfg = self.sources_config.athena
50
- query = self.options.pop("query", None) or cfg.query
50
+ options = dict(self.options)
51
+ query = options.pop("query", None) or cfg.query
51
52
  if not query:
52
53
  raise ValueError("A 'query' must be provided for Athena reads")
53
54
 
54
- options = dict(self.options)
55
55
  if options.get("chunksize"):
56
56
  raise ValueError("Athena reads return a single DataFrame, so the 'chunksize' option is not supported; remove it from the resource options")
57
57
  options.setdefault("database", cfg.database)
@@ -43,10 +43,11 @@ class WithLocal:
43
43
  DataFrame
44
44
  """
45
45
  local_config = self.sources_config.local
46
- file_path = utils.resolve_template(local_config.file_path, self.options)
46
+ options = dict(self.options)
47
+ file_path = utils.resolve_template(local_config.file_path, options)
47
48
  file_type = get_file_type_value(local_config.file_type)
48
49
 
49
- return getattr(self, f"_read_{file_type}_file")(file_path, self.schema, **self.options)
50
+ return getattr(self, f"_read_{file_type}_file")(file_path, self.schema, **options)
50
51
 
51
52
  def _write_to_local(self, df: pd.DataFrame):
52
53
  """Write a dataframe locally based on the {file_type} of the config_io configuration.
@@ -63,9 +64,10 @@ class WithLocal:
63
64
  df: The dataframe to be written out.
64
65
  """
65
66
  local_config = self.sources_config.local
66
- file_path = utils.resolve_template(local_config.file_path, self.options)
67
+ options = dict(self.options)
68
+ file_path = utils.resolve_template(local_config.file_path, options)
67
69
  file_type = get_file_type_value(local_config.file_type)
68
- getattr(self, f"_write_{file_type}_file")(df, file_path, **self.options)
70
+ getattr(self, f"_write_{file_type}_file")(df, file_path, **options)
69
71
 
70
72
  @staticmethod
71
73
  @utils.allow_options(pd.read_hdf)
@@ -288,6 +290,7 @@ class WithLocalBatch(WithLocal):
288
290
  A concatenated dataframe composed of all files read through local_batch.
289
291
  """
290
292
  local_batch_config = self.sources_config.local
293
+ options = dict(self.options)
291
294
 
292
295
  file_type = get_file_type_value(local_batch_config.file_type)
293
296
  filtering_file_type = "h5" if file_type == "hdf" else file_type
@@ -295,11 +298,11 @@ class WithLocalBatch(WithLocal):
295
298
  # Determine if the path is dynamic or static
296
299
  if local_batch_config.dynamic_file_path:
297
300
  # Dynamic path: use it directly
298
- file_path = utils.resolve_template(local_batch_config.dynamic_file_path, self.options)
301
+ file_path = utils.resolve_template(local_batch_config.dynamic_file_path, options)
299
302
  files = sorted(glob.glob(file_path, recursive=True))
300
303
  elif local_batch_config.path_prefix:
301
304
  # Static path: append the file type
302
- file_path = utils.resolve_template(local_batch_config.path_prefix, self.options)
305
+ file_path = utils.resolve_template(local_batch_config.path_prefix, options)
303
306
  files = sorted(glob.glob(os.path.join(file_path, f"*.{filtering_file_type}"), recursive=True))
304
307
  else:
305
308
  raise ValueError("Either path_prefix or dynamic_path must be provided in local_batch_config")
@@ -307,6 +310,6 @@ class WithLocalBatch(WithLocal):
307
310
  dfs_to_concatenate = []
308
311
  for file in files:
309
312
  file_to_load = os.path.join(file_path, file)
310
- dfs_to_concatenate.append(getattr(self, f"_read_{file_type}_file")(file_to_load, self.schema, **self.options))
313
+ dfs_to_concatenate.append(getattr(self, f"_read_{file_type}_file")(file_to_load, self.schema, **options))
311
314
 
312
315
  return pd.concat(dfs_to_concatenate).reset_index(drop=True)
@@ -106,7 +106,8 @@ class WithPostgres:
106
106
 
107
107
  connection_string = f"postgresql://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}"
108
108
 
109
- sql_query = self.options.pop("sql_query", None)
109
+ options = dict(self.options)
110
+ sql_query = options.pop("sql_query", None)
110
111
 
111
112
  assert self.sources_config.dynamicio_schema is not None, "The schema must be specified for SQL tables"
112
113
  model = self._generate_model_from_schema(self.sources_config.dynamicio_schema)
@@ -116,7 +117,7 @@ class WithPostgres:
116
117
  query = sql_query
117
118
  logger.info(f"[postgres] Started downloading table: {self.sources_config.dynamicio_schema.name} from: {db_host}:{db_name}")
118
119
  with session_for(connection_string) as session:
119
- return self._read_database(session, query, **self.options)
120
+ return self._read_database(session, query, **options)
120
121
 
121
122
  @staticmethod
122
123
  def _generate_model_from_schema(schema: DataframeSchema) -> DeclarativeMeta:
@@ -246,10 +246,11 @@ def _split_s3_url(url: str):
246
246
  _SYNC_MAX_CONCURRENCY = 32 # measured best/flat from 32 up for 200-5000 files; the old 10 was up to 2x slower on small prefixes
247
247
 
248
248
 
249
- def _download_file(client, bucket: str, key: str, local_path: str):
249
+ def _download_file(bucket: str, key: str, local_path: str):
250
250
  """Download one object: a single GetObject for small ones, the multipart transfer manager for large ones."""
251
251
 
252
252
  def attempt():
253
+ client = _shared_s3_client() # reacquired: a retry must not reuse the client evicted after the failure
253
254
  response = client.get_object(Bucket=bucket, Key=key)
254
255
  if response["ContentLength"] > _DIRECT_TRANSFER_MAX_BYTES:
255
256
  response["Body"].close()
@@ -292,7 +293,7 @@ def s3_sync_down(source_url: str, dest_dir: str, include_pattern: Optional[str]
292
293
  continue
293
294
  local_path = os.path.join(dest_dir, *relative_key.split("/"))
294
295
  os.makedirs(os.path.dirname(local_path), exist_ok=True)
295
- futures.append(pool.submit(_download_file, client, bucket, obj["Key"], local_path))
296
+ futures.append(pool.submit(_download_file, bucket, obj["Key"], local_path))
296
297
  for future in futures:
297
298
  future.result()
298
299
 
@@ -334,10 +335,11 @@ def s3_read_down(source_url: str, reader: Callable[[io.BytesIO], Any], include_p
334
335
  return [future.result() for future in futures]
335
336
 
336
337
 
337
- def _upload_file(client, local_path: str, bucket: str, key: str, acl: str):
338
+ def _upload_file(local_path: str, bucket: str, key: str, acl: str):
338
339
  """Upload one file: a single PutObject for small ones, the multipart transfer manager for large ones."""
339
340
 
340
341
  def attempt():
342
+ client = _shared_s3_client() # reacquired: a retry must not reuse the client evicted after the failure
341
343
  if os.path.getsize(local_path) > _DIRECT_TRANSFER_MAX_BYTES:
342
344
  client.upload_file(local_path, bucket, key, ExtraArgs={"ACL": acl})
343
345
  return
@@ -358,7 +360,6 @@ def s3_sync_up(source_dir: str, dest_url: str, acl: str = "bucket-owner-full-con
358
360
  """
359
361
  bucket, key_prefix = _split_s3_url(dest_url)
360
362
  key_prefix = f"{key_prefix.rstrip('/')}/" if key_prefix else ""
361
- client = _shared_s3_client()
362
363
 
363
364
  with ThreadPoolExecutor(max_workers=max_concurrency) as pool:
364
365
  futures = []
@@ -366,7 +367,7 @@ def s3_sync_up(source_dir: str, dest_url: str, acl: str = "bucket-owner-full-con
366
367
  for name in files:
367
368
  local_path = os.path.join(root, name)
368
369
  relative_key = os.path.relpath(local_path, source_dir).replace(os.sep, "/")
369
- futures.append(pool.submit(_upload_file, client, local_path, bucket, f"{key_prefix}{relative_key}", acl))
370
+ futures.append(pool.submit(_upload_file, local_path, bucket, f"{key_prefix}{relative_key}", acl))
370
371
  for future in futures:
371
372
  future.result()
372
373
 
@@ -499,15 +500,16 @@ class WithS3PathPrefix(with_local.WithLocal):
499
500
  file_type = get_file_type_value(s3_config.file_type)
500
501
  if file_type != "parquet":
501
502
  raise ValueError(f"File type not supported: {file_type}, only parquet files can be written to an S3 key")
502
- if "partition_cols" not in self.options:
503
+ options = dict(self.options)
504
+ if "partition_cols" not in options:
503
505
  raise ValueError("`partition_cols` is required as an option to write partitioned parquet files to S3")
504
506
 
505
507
  bucket = s3_config.bucket
506
508
  path_prefix = s3_config.path_prefix
507
- full_path_prefix = utils.resolve_template(f"s3://{bucket}/{path_prefix}", self.options)
509
+ full_path_prefix = utils.resolve_template(f"s3://{bucket}/{path_prefix}", options)
508
510
 
509
511
  with tempfile.TemporaryDirectory() as temp_dir:
510
- self._write_parquet_file(df, temp_dir, **self.options)
512
+ self._write_parquet_file(df, temp_dir, **options)
511
513
  s3_sync_up(temp_dir, full_path_prefix)
512
514
 
513
515
  def _read_from_s3_path_prefix(self) -> pd.DataFrame: # pylint: disable=too-many-locals,too-many-branches
@@ -563,15 +565,16 @@ class WithS3PathPrefix(with_local.WithLocal):
563
565
  bucket = s3_config.bucket
564
566
  dynamic_file_path = s3_config.dynamic_file_path
565
567
  path_prefix = s3_config.path_prefix
568
+ options = dict(self.options)
566
569
 
567
570
  if dynamic_file_path:
568
- full_path = utils.resolve_template(f"s3://{bucket}/{dynamic_file_path}", self.options)
571
+ full_path = utils.resolve_template(f"s3://{bucket}/{dynamic_file_path}", options)
569
572
  else:
570
- full_path = utils.resolve_template(f"s3://{bucket}/{path_prefix}", self.options)
573
+ full_path = utils.resolve_template(f"s3://{bucket}/{path_prefix}", options)
571
574
 
572
575
  # The `no_disk_space` option should be used only when reading a subset of columns from S3. Parquet needs no special
573
576
  # handling: it is always parsed in memory, a few objects at a time, on the download threads.
574
- if self.options.pop("no_disk_space", False) and path_prefix:
577
+ if options.pop("no_disk_space", False) and path_prefix:
575
578
  if file_type == "hdf":
576
579
  dfs: List[DataFrame] = []
577
580
  for fobj in self._iter_s3_files(full_path, file_ext=".h5", max_memory_use=1024**3): # 1 gib
@@ -585,14 +588,14 @@ class WithS3PathPrefix(with_local.WithLocal):
585
588
  absent: List[str] = []
586
589
 
587
590
  def reader(fobj: io.BytesIO) -> pd.DataFrame:
588
- return self._read_parquet_object(fobj, absent)
591
+ return _read_parquet_object(fobj, self.schema, options, absent)
589
592
 
590
593
  if dynamic_file_path:
591
594
  prefix, suffix = full_path.rsplit("/**/", 1)
592
595
  results = s3_read_down(prefix, reader, include_pattern=f"**/{suffix}")
593
596
  else:
594
597
  results = s3_read_down(full_path, reader)
595
- return self._concat_parquet_objects([df for df in results if len(df) > 0] or results, absent, full_path)
598
+ return _concat_parquet_objects([df for df in results if len(df) > 0] or results, absent, full_path, self.schema, options)
596
599
 
597
600
  with tempfile.TemporaryDirectory() as temp_dir:
598
601
  if dynamic_file_path:
@@ -603,20 +606,12 @@ class WithS3PathPrefix(with_local.WithLocal):
603
606
 
604
607
  dfs: List[DataFrame] = []
605
608
  for file in os.listdir(temp_dir):
606
- df = getattr(self, f"_read_{file_type}_file")(os.path.join(temp_dir, file), self.schema, **self.options) # type: ignore
609
+ df = getattr(self, f"_read_{file_type}_file")(os.path.join(temp_dir, file), self.schema, **options) # type: ignore
607
610
  if len(df) > 0:
608
611
  dfs.append(df)
609
612
 
610
613
  return pd.concat(dfs, ignore_index=True)
611
614
 
612
- def _read_parquet_object(self, fobj: IO[bytes], absent: List[str]) -> pd.DataFrame:
613
- """Read one parquet object of a prefix, tolerating requested columns that this object does not contain."""
614
- return _read_parquet_object(fobj, self.schema, self.options, absent)
615
-
616
- def _concat_parquet_objects(self, dfs: List[DataFrame], absent: List[str], source: str) -> DataFrame:
617
- """Concatenate the frames of a prefix, warning about columns some objects lack and failing on columns none have."""
618
- return _concat_parquet_objects(dfs, absent, source, self.schema, self.options)
619
-
620
615
  def _iter_s3_files(self, s3_prefix: str, file_ext: Optional[str] = None, max_memory_use: int = -1) -> Generator[IO[bytes], None, None]: # pylint: disable=too-many-locals
621
616
  """Download sways of S3 objects.
622
617
 
@@ -682,7 +677,7 @@ class WithS3File:
682
677
  """
683
678
  s3_config = self.sources_config.s3
684
679
  file_type = get_file_type_value(s3_config.file_type)
685
- options = getattr(self, "options", {})
680
+ options = dict(getattr(self, "options", {}))
686
681
  s3_path = f"s3://{s3_config.bucket}/{utils.resolve_template(s3_config.file_path, options)}"
687
682
 
688
683
  logger.info(f"[s3] Started downloading: {s3_path}")
@@ -784,7 +779,7 @@ class WithS3File:
784
779
  """
785
780
  s3_config = self.sources_config.s3
786
781
  file_type = get_file_type_value(s3_config.file_type)
787
- options = getattr(self, "options", {})
782
+ options = dict(getattr(self, "options", {}))
788
783
  s3_path = f"s3://{s3_config.bucket}/{utils.resolve_template(s3_config.file_path, options)}"
789
784
 
790
785
  logger.info(f"[s3] Started uploading: {s3_path}")
@@ -1,8 +1,7 @@
1
1
  [project]
2
2
  name = "dynamicio"
3
- dynamic = ["version"] # derived from the git tag at build time (hatch-vcs)
3
+ dynamic = ["version", "readme"] # version: from the git tag at build time (hatch-vcs); readme: README.md plus CHANGELOG.md (hatch-fancy-pypi-readme)
4
4
  description = "Panda's wrapper for IO operations"
5
- readme = "README.md"
6
5
  license = "Apache-2.0"
7
6
  requires-python = ">=3.10"
8
7
  authors = [
@@ -35,6 +34,9 @@ dependencies = [
35
34
  "tables>=3.10.1",
36
35
  ]
37
36
 
37
+ [project.urls]
38
+ Changelog = "https://github.com/VorTECHsa/dynamicio/blob/master/CHANGELOG.md"
39
+
38
40
  [project.scripts]
39
41
  dynamicio = "dynamicio.cli:run"
40
42
 
@@ -72,7 +74,7 @@ docs = [
72
74
  ]
73
75
 
74
76
  [build-system]
75
- requires = ["hatchling", "hatch-vcs"]
77
+ requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
76
78
  build-backend = "hatchling.build"
77
79
 
78
80
  [tool.hatch.version]
@@ -81,6 +83,18 @@ source = "vcs"
81
83
  [tool.hatch.version.raw-options]
82
84
  local_scheme = "no-local-version"
83
85
 
86
+ [tool.hatch.metadata.hooks.fancy-pypi-readme]
87
+ content-type = "text/markdown"
88
+
89
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
90
+ path = "README.md"
91
+
92
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
93
+ text = "\n\n"
94
+
95
+ [[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
96
+ path = "CHANGELOG.md"
97
+
84
98
  [tool.hatch.build.targets.wheel]
85
99
  packages = ["dynamicio"]
86
100
 
@@ -114,6 +114,18 @@ class TestAthenaWranglerArguments:
114
114
  assert kwargs["s3_output"] == "s3://test-staging/"
115
115
  assert kwargs["workgroup"] == "test_wg"
116
116
 
117
+ @patch("dynamicio.mixins.with_athena.wr.athena.read_sql_query")
118
+ def test_read_twice_runs_the_query_from_the_options_both_times(self, mock_wr_read, test_df):
119
+ mock_wr_read.return_value = test_df
120
+ io_obj = ReadAthenaIO(source_config=_athena_config("READ_FROM_ATHENA"), query="SELECT 1")
121
+ options_before = dict(io_obj.options)
122
+
123
+ io_obj.read()
124
+ io_obj.read()
125
+
126
+ assert [call.args for call in mock_wr_read.call_args_list] == [("SELECT 1",), ("SELECT 1",)]
127
+ assert io_obj.options == options_before
128
+
117
129
  @patch("dynamicio.mixins.with_athena.wr.athena.read_sql_query")
118
130
  def test_ctas_is_off_by_default_and_can_be_enabled(self, mock_wr_read, test_df):
119
131
  mock_wr_read.return_value = test_df
@@ -163,6 +163,26 @@ class TestPostgresIO:
163
163
  # Then
164
164
  mock__read_database.assert_called_with(ANY, "SELECT * FROM example")
165
165
 
166
+ @pytest.mark.unit
167
+ @patch.object(WithPostgres, "_read_database")
168
+ def test_read_twice_runs_the_query_from_the_options_both_times(self, mock__read_database):
169
+ # Given
170
+ postgres_cloud_config = IOConfig(
171
+ path_to_source_yaml=(os.path.join(constants.TEST_RESOURCES, "definitions/input.yaml")),
172
+ env_identifier="CLOUD",
173
+ dynamic_vars=constants,
174
+ ).get(source_key="READ_FROM_POSTGRES")
175
+ io_obj = ReadPostgresIO(source_config=postgres_cloud_config, sql_query="SELECT * FROM example")
176
+ options_before = dict(io_obj.options)
177
+
178
+ # When
179
+ io_obj.read()
180
+ io_obj.read()
181
+
182
+ # Then
183
+ assert [call.args[1] for call in mock__read_database.call_args_list] == ["SELECT * FROM example", "SELECT * FROM example"]
184
+ assert io_obj.options == options_before
185
+
166
186
  @pytest.mark.unit
167
187
  @patch.object(WithPostgres, "_read_database")
168
188
  def test_read_from_postgres_with_query_in_options(self, mock__read_database):