Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure socrata workflow inputs are handled correctly #699

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

wrridgeway
Copy link
Member

@wrridgeway wrridgeway commented Jan 7, 2025

The default workflow value for years, 'all', was not being handled correctly since it becomes a list during ingest. Additionally, spaces in the years input could lead to year values not being handled correctly.

Since the columns that get updated currently depend on how the response from the API and the column names of the athena view that feeds the asset match up, it'd be nice to be able to confirm that all expected columns are in fact going to be updated.

@@ -333,6 +337,6 @@ def socrata_upload(
socrata_upload(
socrata_asset=os.getenv("SOCRATA_ASSET"),
overwrite=os.getenv("OVERWRITE"),
years=str(os.getenv("YEARS")).split(","),
years=str(os.getenv("YEARS")).replace(" ", "").split(","),
Copy link
Member Author

@wrridgeway wrridgeway Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this entering "2023, 2024" in the github action will pass '2023' and ' 2024' and not actually pull 2024.

socrata/socrata_upload.py Outdated Show resolved Hide resolved
@@ -204,7 +206,7 @@ def generate_groups(athena_asset, years=None, by_township=False):
if not years and by_township:
raise ValueError("Cannot set 'by_township' when 'years' is None")

if years == "all":
if years == ["all"]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default 'all' is turned into ['all'] when inherited through the environment and this logic wasn't properly reacting to it.

@wrridgeway wrridgeway changed the title Print columns that will be updated for open data asset Ensure socrata workflow inputs are handled correctly Jan 9, 2025
@wrridgeway wrridgeway marked this pull request as ready for review January 9, 2025 15:38
@wrridgeway wrridgeway requested a review from a team as a code owner January 9, 2025 15:38
Copy link
Contributor

@jeancochrane jeancochrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

socrata/socrata_upload.py Outdated Show resolved Hide resolved
@wrridgeway wrridgeway merged commit 607e38a into master Jan 9, 2025
7 checks passed
@wrridgeway wrridgeway deleted the print-updated-columns branch January 9, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants