Polytomic Python Client

1.17.1 · active · verified Thu Apr 16

The Polytomic Python library provides convenient access to the Polytomic API for managing ETL, ELT, Reverse ETL, and general data syncing between various systems. It supports integration with data warehouses, databases, cloud applications, and HTTP APIs. The library is actively maintained, frequently updated to support new features and integrations, and is currently at version 1.17.1.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the Polytomic client and make a basic API call to list bulk syncs. It uses an environment variable for the API token for security best practices. To run the commented-out `create` example, you would need valid connection IDs from your Polytomic account.

import os
from polytomic.client import Polytomic
from polytomic import BulkSchedule

# Best practice: Load token from environment variable
POLYTOMIC_TOKEN = os.environ.get('POLYTOMIC_TOKEN', 'YOUR_POLYTOMIC_API_KEY')

if POLYTOMIC_TOKEN == 'YOUR_POLYTOMIC_API_KEY':
    print("Please set the POLYTOMIC_TOKEN environment variable or replace 'YOUR_POLYTOMIC_API_KEY'.")
else:
    try:
        client = Polytomic(token=POLYTOMIC_TOKEN)

        # Example: Listing bulk syncs (replace with actual API call relevant to your use case)
        bulk_syncs = client.bulk_sync.list()
        print(f"Successfully connected. Found {len(bulk_syncs.data)} bulk syncs.")

        # Example of creating a bulk sync (dummy data for illustration, needs valid IDs)
        # try:
        #     new_sync = client.bulk_sync.create(
        #         destination_connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", # Replace with actual ID
        #         mode="replicate",
        #         name="My New Bulk Sync",
        #         schedule=BulkSchedule(frequency="manual"),
        #         source_connection_id="248df4b7-aa70-47b8-a036-33ac447e668d", # Replace with actual ID
        #     )
        #     print(f"Created new bulk sync with ID: {new_sync.data.id}")
        # except Exception as e:
        #     print(f"Error creating bulk sync: {e}")

    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →