Environment Variable Access
When running custom Python functions on Definite, theDEFINITE_API_KEY is automatically injected into your execution environment. You can access it using the standard Python environment variable pattern:
- The API key is automatically provided - no need to manually set it
- Access it via
os.environ["DEFINITE_API_KEY"]for standard Python compatibility - Perfect for use with the Definite SDK or making direct API calls
- Alternative: You can also access it directly as a global variable
DEFINITE_API_KEY
Installation
pip:Key-Value Store
The SDK can store and update key-value objects that can be called by custom Python scripts hosted on Definite. An example use case might be saving/retrieving replication state for a custom data connector. Example:SQL Query Execution
Execute SQL queries against your connected database integrations.Cube Query Execution
Execute Cube queries for advanced analytics and data modeling.Secret Store
Securely store and retrieve secrets for your integrations.Integration Management
Manage your data integrations and connections.Messaging
Send messages through various channels using the messaging client.Drive Client
Upload arbitrary bytes to your team’s Definite Drive and get back ags:// path that’s usable in SQL. The file goes client → GCS directly via a signed URL (the backend only mints the URL), so there’s no local GCS auth, no Cloud Run timeout, and no 32 MB body limit.
write_file and write_temporary_file accept bytes, str, a local path (os.PathLike), or any readable file-like object. Large files stream via requests — no chunking logic needed.
Load local data into DuckLake
Combine the Drive client with the SQL client to load a local file — an API response, a DataFrame, a generated parquet — into the lake. The ingest SQL runs on the Definite backend against the team’s DuckLake; no local DuckDB required.Legacy: attach_ducklake()
For teams provisioned before April 2026 that still have HMAC keys on their DuckLake integration, client.attach_ducklake() returns SQL that attaches the lake to a local DuckDB connection. This is deprecated and emits a DeprecationWarning — new code should use get_drive_client() + get_sql_client() as shown above.

