polars.io.parquet.encryption.EncryptionConfiguration#

class polars.io.parquet.encryption.EncryptionConfiguration(
footer_key: str,
*,
column_keys: Mapping[str, Sequence[str]] | None = None,
uniform_encryption: bool = False,
plaintext_footer: bool = False,
double_wrapping: bool = True,
cache_lifetime: timedelta = timedelta(seconds=600),
)[source]#

Configuration for writing Parquet files with keys managed by a KMS.

Warning

This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.

Exactly one of column_keys or uniform_encryption must be set.

Parameters:
footer_key

The ID of the master key used to encrypt the file footer, or to sign the footer if plaintext_footer is set.

column_keys

Which columns to encrypt, as a mapping from the ID of a master key to the names of the columns encrypted with it. Only these columns are encrypted. For nested columns, the column name is the dot-separated path in the Parquet schema, e.g. a.b.c.

uniform_encryption

Encrypt all columns with the footer key.

plaintext_footer

Write the file footer in plaintext rather than encrypting it, so that readers without the footer key can read the schema and any unencrypted columns. The footer is still signed with the footer key.

double_wrapping

Wrap data encryption keys with key encryption keys, which are wrapped by the master keys in the KMS. This reduces the number of KMS calls. If false, data encryption keys are wrapped by the KMS directly.

cache_lifetime

How long to cache KMS clients and key encryption keys for.

__init__(
footer_key: str,
*,
column_keys: Mapping[str, Sequence[str]] | None = None,
uniform_encryption: bool = False,
plaintext_footer: bool = False,
double_wrapping: bool = True,
cache_lifetime: timedelta = timedelta(seconds=600),
) → None[source]#

Methods

__init__(footer_key, *[, column_keys, ...])

Attributes

cache_lifetime

How long KMS clients and key encryption keys are cached for.

column_keys

The columns encrypted with each master key.

double_wrapping

Whether data encryption keys are wrapped with key encryption keys.

footer_key

The ID of the master key used for the footer.

plaintext_footer

Whether the footer is written in plaintext.

uniform_encryption

Whether all columns are encrypted with the footer key.