Skip to content

Conversation

@lelouvincx
Copy link
Contributor

When resolving templated YAML, Prefect deserializes them as strings. This behavior is not correct for all cases, especially when extracting a key-value pair from a dictionary.

This PR adds an option to resolve it.

Closes #17492

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

@github-actions github-actions bot added the enhancement An improvement of an existing feature label Mar 16, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 16, 2025

CodSpeed Performance Report

Merging #17493 will not alter performance

Comparing lelouvincx:fix/17492-deserialize-block-as-dict (4b602f1) with main (4e56e18)

Summary

✅ 2 untouched benchmarks

@desertaxle
Copy link
Member

Thanks for the PR @lelouvincx! The Secret block type is meant to only be used for simple, unformatted strings, but we do have other ways to store formatted secrets.

I noticed in the linked issue that you're storing GCP credentials via a secret block. For this case, I'd recommend using the GcpCredentials block which uses the SecretDict type for the service_account_info field. This allows you to securely store those credentials and interact with them as a dictionary, which it looks like you want to do.

Since there's existing functionality for this case, it's unlikely that we'll accept this PR, but let me know if you run into issues using the GcpCrednetials block and we can discuss solutions!

@lelouvincx lelouvincx closed this Mar 22, 2025
@lelouvincx lelouvincx deleted the fix/17492-deserialize-block-as-dict branch March 22, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to deserialize a Secret Block's value to JSON

2 participants