# Avg Charge Amount by Calendar Cal Date Quarter Of Year

This is a sample query that you can use on airbyte-stripe charges data when you connect it to Splitgraph.

``````WITH calendar AS (SELECT dateadd('days'
, CAST(((((((((((p0.n + ((p1.n * 2))) + ((p2.n * power(2, 2)))) + ((p3.n * power(2, 3)))) + ((p4.n * power(2, 4)))) + ((p5.n * power(2, 5)))) + ((p6.n * power(2, 6)))) + ((p7.n * power(2, 7)))) + ((p8.n * power(2, 8)))) + ((p9.n * power(2, 9)))) + ((p10.n * power(2, 10)))) AS integer)
, CAST('2012-11-01' AS date)) AS cal_date
FROM (SELECT 0 AS n

UNION

SELECT 1) AS p0
, (SELECT 0 AS n

UNION

SELECT 1) AS p1
, (SELECT 0 AS n

UNION

SELECT 1) AS p2
, (SELECT 0 AS n

UNION

SELECT 1) AS p3
, (SELECT 0 AS n

UNION

SELECT 1) AS p4
, (SELECT 0 AS n

UNION

SELECT 1) AS p5
, (SELECT 0 AS n

UNION

SELECT 1) AS p6
, (SELECT 0 AS n

UNION

SELECT 1) AS p7
, (SELECT 0 AS n

UNION

SELECT 1) AS p8
, (SELECT 0 AS n

UNION

SELECT 1) AS p9
, (SELECT 0 AS n

UNION

SELECT 1) AS p10
, CAST((((((((((((p0.n + ((p1.n * 2))) + ((p2.n * power(2, 2)))) + ((p3.n * power(2, 3)))) + ((p4.n * power(2, 4)))) + ((p5.n * power(2, 5)))) + ((p6.n * power(2, 6)))) + ((p7.n * power(2, 7)))) + ((p8.n * power(2, 8)))) + ((p9.n * power(2, 9)))) + ((p10.n * power(2, 10))))) AS integer)
, CAST(('2012-11-01') AS date)) <= CURRENT_DATE)

SELECT 'Q' || date_part('quarter', calendar.cal_date) AS "calendar.cal_date_quarter_of_year"
, avg(((charges.amount * 1.0)) / 100) AS "charges.avg_charge_amount"
LEFT JOIN "your-username~stripe".charges AS charges ON date_trunc('day', calendar.cal_date) = date_trunc('day', charges.created)
GROUP BY 1
ORDER BY 1``````
###### Use this query
Connect your Stripe data to Splitgraph to run this query now.

# Tables available in the Stripe data source

Here are all the tables you will be able to access when you use Splitgraph to query Stripe data. We have also listed some useful queries that you can run.

### charges

See all sample queries

•
Avg Charge Amount by Calendar Cal Date Day Of Week Index
•
Avg Charge Amount by Calendar Cal Date Quarter
•
Avg Charge Amount by Calendar Cal Date Quarter Of Year

### subscriptions

``````repositories:
- namespace: CHANGEME
repository: airbyte-stripe
# Catalog-specific metadata for the repository. Optional.
description: Description of the repository
topics:
- sample_topic
# Data source settings for the repository. Optional.
external:
# Name of the credential that the plugin uses. This can also be a credential_id if the
# credential is already registered on Splitgraph.
credential: airbyte-stripe
plugin: airbyte-stripe
# Plugin-specific parameters matching the plugin's parameters schema
params:
account_id: ''  # REQUIRED. Account ID. Your Stripe account ID (starts with 'acct_', find yours <a href="https://dashboard.stripe.com/settings/account">here</a>).
start_date: '2017-01-25T00:00:00Z' # REQUIRED. Replication start date. UTC date and time in the format 2017-01-25T00:00:00Z. Only data generated after this date will be replicated.
normalization_mode: basic # Post-ingestion normalization. Whether to normalize raw Airbyte tables. `none` is no normalization, `basic` is Airbyte's basic normalization, `custom` is a custom dbt transformation on the data.. One of none, basic, custom
normalization_git_branch: master # dbt model Git branch. Branch or commit hash to use for the normalization dbt project.
lookback_window_days: 0 # Lookback Window in days (Optional). When set, the connector will always re-export data from the past N days, where N is the value set here. This is useful if your data is frequently updated after creation. More info <a href="https://docs.airbyte.com/integrations/sources/stripe#requirements">here</a>
tables:
sample_table:
# Plugin-specific table parameters matching the plugin's schema
options:
airbyte_cursor_field: []  # Cursor field(s). Fields in this stream to be used as a cursor for incremental replication (overrides Airbyte configuration's cursor_field)
airbyte_primary_key_field: [] # Primary key field(s). Fields in this stream to be used as a primary key for deduplication (overrides Airbyte configuration's primary_key)
# Schema of the table, a list of objects with `name` and `type`. If set to `[]`, will infer.
schema: []
# Whether live querying is enabled for the plugin (creates a "live" tag in the
# repository proxying to the data source). The plugin must support live querying.
is_live: false
# Ingestion schedule settings. Disable this if you're using GitHub Actions or other methods
# to trigger ingestion.
schedule:
credentials:
airbyte-stripe:  # This is the name of this credential that "external" sections can reference.
plugin: airbyte-stripe
# Credential-specific data matching the plugin's credential schema
data:
client_secret: ''  # REQUIRED. Secret Key. Stripe API key (usually starts with 'sk_live_'; find yours <a href="https://dashboard.stripe.com/apikeys">here</a>).
normalization_git_url: '' # dbt model Git URL. For `custom` normalization, a URL to the Git repo with the dbt project, for example,`https://uname:pass_or_token@github.com/organisation/repository.git`.
``````
###### Use Data Source in splitgraph.yml
You can copy this into splitgraph.yml, or we'll generate it for you.

### Developer-first

Use our splitgraph.yml format to check your Splitgraph configuration into version control, trigger ingestion jobs and manage your data stack like your code.

Get started

### What is Splitgraph?

Splitgraph is a data API to power your analytics, data visualizations and other read-intensive applications.

Get started

# Why Splitgraph andStripe?

Splitgraph connects your vast, unrelated data sources and puts them in a single, accessible place.

### Unify your data stack

Splitgraph handles data integration, storage, transformation and discoverability for you. All that remains is adding a BI client.

### Power your applications

Focus on building data-driven applications without worrying about where the data will come from.

### Not just Data Source...

Splitgraph supports data ingestion from over 100 SaaS services, as well as data federation to over a dozen databases. These are all made queryable over a PostgreSQL-compatible interface.

### Optimized for analytics

Splitgraph stores data in a columnar format. This accelerates analytical queries and makes it perfect for dashboards, blogs and other read-intensive use cases.

# Do more withStripe?

### Stripe on Splitgraph

Read more about Splitgraph’s support for Stripe, including its documentation and sample queries you can run on Stripe data with Splitgraph.

Stripe overview

### Connecting to Splitgraph

Splitgraph has a PostgreSQL-compatible endpoint that most BI clients can connect to.