Via remote query connectors
Zenskar allows you to derive billable metrics by running queries directly on your production databases or data warehouses—without transferring or storing any raw usage events within Zenskar. This ensures your systems remain the single source of truth, while enabling real-time access to metric computations.
When to use this
- Your usage events are already stored in a production database or warehouse.
- You want to avoid data duplication or delay.
- You need real-time visibility or direct query-based control over what is ingested.
Supported data sources
You can connect any of the following sources using a remote query:
- PostgreSQL
- MySQL
- Amazon Redshift
- Snowflake
- BigQuery
- Microsoft SQL Server
Additional databases may be supported through bespoke connectors for your specific infrastructure.
Prerequisites
- A database user with read-only access.
- IP allowlisting or network access permissions (e.g., via VPC peering or SSH tunneling).
How to set up a remote query source
-
In Zenskar, go to Usage > Data Sources.
-
Click + ADD DATA SOURCE.
-
Choose your source type (e.g., PostgreSQL, Snowflake).
-
Select Directly from source under the Source Access section.
-
Fill in the connection details under the Source Config section:
- Host, port, database name, username/password
- SSL or SSH settings as needed
-
Save and activate the source. Zenskar will schedule queries at regular intervals.
What happens next
- Zenskar executes the configured query on your database.
- The query results are processed and shown in your ingestion table.
- You can build billable metrics from this data using the visual or SQL metric builder.
Pros and cons
Pros | Cons |
---|---|
Fresh data with no duplication | Requires reliable network access |
Flexible querying and filtering | May affect source performance if not optimized |
No need to transfer large datasets | Needs SQL familiarity and ops involvement |
Best practices
- Use incremental queries with a
WHERE timestamp > last_run_time
clause. - Query a read replica instead of your production DB if available.
- Limit columns to only what’s needed for metering and invoicing.
- Monitor and optimize long-running queries.
Next steps
- Create billable metrics from the ingested data: Billable metrics
- Explore other ingestion methods
- Learn how to define metric logic using the SQL builder
Updated 8 days ago