Path: blob/main/docs/source/polars-cloud/integrations/prefect.md
8362 views
Prefect
Configure Polars Cloud authentication securely within Prefect workflows using native secret management patterns. This section details how to integrate Polars Cloud service account credentials with Prefect's configuration system.
Prefect implements secure credential handling through three standard approaches:
Secret manager (recommended): pull the secret secret manager of your choice and use it in your workflow (see official docs; here is AWS' as an example). One can also use the AWS-specific
SecretBlock(see below; docs) to interact with the AWS Secret Manager.Environment variables: load your environment variables into your running instance (container or else).
Blocksystem (docs): Prefect defined aBlockframework that can be used via the CLI (prefect block register -m prefect.blocks.system) or directly in the code (from prefect.blocks.system import Secret). A secret can be created via CLI (for instance):prefect block create secret polars-cloud-client-idand retrieved from the code asSecret.load("polars-cloud-client-id").get().
Some code snippets for solutions #1 and #2 described above:
Below a few lines of pseudo-code to define a Prefect flow: