code: def parquet_write_read_with_vault(parquet_filename):
      """An example for writing an encrypted parquet and reading an
      encrypted parquet using master keys managed by Hashicorp Vault KMS.
      Note that for this implementation requests dependency is needed
      and environment properties VAULT_URL and VAULT_TOKEN should be set.
      Please enable the transit engine.
      """
      path = parquet_filename
  
      table = pa.Table.from_pydict(
          {
              "a": pa.array([1, 2, 3]),
              "b": pa.array(["a", "b", "c"]),
              "c": pa.array(["x", "y", "z"]),
          }
      )
  
      # Encrypt the footer with the footer key,
      # encrypt column `a` with one key
      # and column `b` with another key,
      # keep `c` plaintext
      footer_key_name = "footer_key"
      col_a_key_name = "col_a_key"
      col_b_key_name = "col_b_key"
  
      encryption_config = pe.EncryptionConfiguration(
          footer_key=footer_key_name,
          column_keys={
              col_a_key_name: ["a"],
              col_b_key_name: ["b"],
          },
      )
  
      kms_connection_config = pe.KmsConnectionConfig(
          kms_instance_url=os.environ.get("VAULT_URL", ""),
          key_access_token=os.environ.get("VAULT_TOKEN", ""),
      )
  
      def kms_factory(kms_connection_configuration):
          return VaultClient(kms_connection_configuration)
  
      # Write with encryption properties
      crypto_factory = pe.CryptoFactory(kms_factory)
      file_encryption_properties = (
          crypto_factory.file_encryption_properties(
              kms_connection_config, encryption_config
          )
      )
      with pq.ParquetWriter(
          path,
          table.schema,
          encryption_properties=file_encryption_properties,
      ) as writer:
          writer.write_table(table)
  
      # Read with decryption properties
      file_decryption_properties = (
          crypto_factory.file_decryption_properties(
              kms_connection_config
          )
      )
      result = pq.ParquetFile(
          path, decryption_properties=file_decryption_properties
      )
      result_table = result.read()
      assert table.equals(result_table)
  
file_path: arrow/python/examples/parquet_encryption/sample_vault_kms_client.py
imports: import argparse
  import base64
  import os
  import requests
  import pyarrow
  import pyarrow.parquet
  import pyarrow.parquet.encryption
label_desc: Use image node_id 1 for calling a global function with example usage: parquet_write_read_with_vault(parquet_filename) and returns: VaultClient