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

  1. In Zenskar, go to Usage > Data Sources.

  2. Click + ADD DATA SOURCE.

  3. Choose your source type (e.g., PostgreSQL, Snowflake).

  4. Select Directly from source under the Source Access section.

  5. Fill in the connection details under the Source Config section:

    • Host, port, database name, username/password
    • SSL or SSH settings as needed
  6. 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

ProsCons
Fresh data with no duplicationRequires reliable network access
Flexible querying and filteringMay affect source performance if not optimized
No need to transfer large datasetsNeeds 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