{"id":9190,"library":"polytomic","title":"Polytomic Python Client","description":"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.","status":"active","version":"1.17.1","language":"en","source_language":"en","source_url":"https://github.com/polytomic/polytomic-python","tags":["API client","data integration","ETL","ELT","Reverse ETL","sync","automation"],"install":[{"cmd":"pip install polytomic","lang":"bash","label":"Install Polytomic Python Client"}],"dependencies":[{"reason":"Requires Python version 3.8 or higher, but less than 4.0.","package":"python","optional":false}],"imports":[{"symbol":"Polytomic","correct":"from polytomic.client import Polytomic"},{"note":"For asynchronous API calls.","symbol":"AsyncPolytomic","correct":"from polytomic.client import AsyncPolytomic"},{"note":"Example of an imported model for API request bodies.","symbol":"BulkSchedule","correct":"from polytomic import BulkSchedule"}],"quickstart":{"code":"import os\nfrom polytomic.client import Polytomic\nfrom polytomic import BulkSchedule\n\n# Best practice: Load token from environment variable\nPOLYTOMIC_TOKEN = os.environ.get('POLYTOMIC_TOKEN', 'YOUR_POLYTOMIC_API_KEY')\n\nif POLYTOMIC_TOKEN == 'YOUR_POLYTOMIC_API_KEY':\n    print(\"Please set the POLYTOMIC_TOKEN environment variable or replace 'YOUR_POLYTOMIC_API_KEY'.\")\nelse:\n    try:\n        client = Polytomic(token=POLYTOMIC_TOKEN)\n\n        # Example: Listing bulk syncs (replace with actual API call relevant to your use case)\n        bulk_syncs = client.bulk_sync.list()\n        print(f\"Successfully connected. Found {len(bulk_syncs.data)} bulk syncs.\")\n\n        # Example of creating a bulk sync (dummy data for illustration, needs valid IDs)\n        # try:\n        #     new_sync = client.bulk_sync.create(\n        #         destination_connection_id=\"248df4b7-aa70-47b8-a036-33ac447e668d\", # Replace with actual ID\n        #         mode=\"replicate\",\n        #         name=\"My New Bulk Sync\",\n        #         schedule=BulkSchedule(frequency=\"manual\"),\n        #         source_connection_id=\"248df4b7-aa70-47b8-a036-33ac447e668d\", # Replace with actual ID\n        #     )\n        #     print(f\"Created new bulk sync with ID: {new_sync.data.id}\")\n        # except Exception as e:\n        #     print(f\"Error creating bulk sync: {e}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n","lang":"python","description":"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."},"warnings":[{"fix":"For feature requests or bug fixes, open an issue on the GitHub repository to discuss with the Polytomic team. For documentation improvements, direct PRs to the README are welcome.","message":"The Polytomic Python library is programmatically generated from an OpenAPI specification. Direct contributions to the generated code will not be merged as-is and will be overwritten in subsequent releases. Users are advised to open an issue first to discuss desired changes or contribute to the README.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review Databricks bulk sync workflows and adapt any downstream dependencies that relied on the previous 'replace before write' behavior for tables that support temporary staging and renaming. For `hive_metastore` destinations, the behavior remains unchanged.","message":"A behavioral change was introduced for bulk syncs to Databricks. Previously, the destination table was replaced *before* data was written. As of Release 2025.02.20, data will be staged in a temporary table and then renamed during a resync, if possible. Syncs to default `hive_metastore` (where renaming is unsupported) will continue to replace the table at the start of the sync.","severity":"breaking","affected_versions":">=2025.02.20"},{"fix":"Instead of using the `type` parameter, use the `whitelist` parameter, which accepts a list of connection types that are allowed to be created.","message":"The `type` parameter in the `connections/connect` API endpoint has been deprecated. While it may still function, its use is discouraged and it may be removed in future API versions.","severity":"deprecated","affected_versions":"API versions 2024-02-08 and later"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install polytomic` to install the library. Verify the spelling of the import statement.","cause":"The `polytomic` library has not been installed in your Python environment or there is a typo in the import statement.","error":"ModuleNotFoundError: No module named 'polytomic'"},{"fix":"Ensure that the `token` parameter passed to the `Polytomic` client constructor is a valid and active API key with the necessary permissions. Double-check for typos or ensure the environment variable `POLYTOMIC_TOKEN` is correctly set if using that method.","cause":"The Polytomic API token provided to the client is either missing, invalid, or has insufficient permissions for the requested operation.","error":"polytomic.client.ApiException: (401)\nReason: Unauthorized"},{"fix":"Always check if the `data` attribute or other response fields are not `None` before attempting to access their properties or iterating over them. Implement robust error handling for API responses.","cause":"Often occurs when an API call returns `None` (e.g., if a resource is not found or an error occurred, and the response parsing expects an iterable or an object with a length) but the code attempts to access it as if it were a valid data structure. This can happen if `client.some_endpoint.list().data` is `None`.","error":"TypeError: object of type 'NoneType' has no len()"}]}