Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/recipes/ecto/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PORT=4009
CUBEJS_PG_SQL_PORT=9432
CUBEJS_DB_TYPE=postgres
CUBEJS_DB_PORT=8432
CUBEJS_DB_NAME=pot_examples_dev
CUBEJS_DB_USER=postgres
CUBEJS_DB_PASS=postgres
CUBEJS_DB_HOST=localhost
CUBEJS_DEV_MODE=true
CUBEJS_LOG_LEVEL=trace
NODE_ENV=development
CUBEJS_DB_QUERY_TIMEOUT="60m"
CUBEJS_CONCURRENCY=128
28 changes: 28 additions & 0 deletions examples/recipes/ecto/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Runtime logs
*.log

# Process ID files
*.pid

# Node modules (uses root workspace)
node_modules/

# Yarn lock (uses root workspace yarn.lock)
yarn.lock

# Environment file (use .env.example as template)
.env

# Build artifacts
bin/

# CubeStore data
.cubestore/
.venv/
/__pycache__*
/fix-formatting.sh
/run-ci-tests-local.sh
/rebuild-after-rebase.sh
/run-clippy.sh
/run-quick-checks.sh
/run-tests-only.sh
16 changes: 16 additions & 0 deletions examples/recipes/ecto/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
postgresql:
container_name: cube_postgresql
image: docker.io/postgres:alpine
restart: always
command: -c 'max_connections=1024' -c 'shared_buffers=32GB'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 8432:5432
volumes:
- postgresql:/var/lib/postgresql/data

volumes:
postgresql:
109 changes: 109 additions & 0 deletions examples/recipes/ecto/model/cubes/datatypes_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
cubes:
- name: datatypes_test
sql_table: public.datatypes_test_table

title: Data Types Test Cube
description: Cube for testing all supported Arrow data types

dimensions:
- name: an_id
type: number
primary_key: true
sql: id
# Integer types
- name: int8_col
sql: int8_val
type: number
meta:
arrow_type: int8

- name: int16_col
sql: int16_val
type: number
meta:
arrow_type: int16

- name: int32_col
sql: int32_val
type: number
meta:
arrow_type: int32

- name: int64_col
sql: int64_val
type: number
meta:
arrow_type: int64

# Unsigned integer types
- name: uint8_col
sql: uint8_val
type: number
meta:
arrow_type: uint8

- name: uint16_col
sql: uint16_val
type: number
meta:
arrow_type: uint16

- name: uint32_col
sql: uint32_val
type: number
meta:
arrow_type: uint32

- name: uint64_col
sql: uint64_val
type: number
meta:
arrow_type: uint64

# Float types
- name: float32_col
sql: float32_val
type: number
meta:
arrow_type: float32

- name: float64_col
sql: float64_val
type: number
meta:
arrow_type: float64

# Boolean
- name: bool_col
sql: bool_val
type: boolean

# String
- name: string_col
sql: string_val
type: string

# Date/Time types
- name: date_col
sql: date_val
type: time
meta:
arrow_type: date32

- name: timestamp_col
sql: timestamp_val
type: time
meta:
arrow_type: timestamp

measures:
- name: count
type: count

- name: int32_sum
type: sum
sql: int32_val

- name: float64_avg
type: avg
sql: float64_val
162 changes: 162 additions & 0 deletions examples/recipes/ecto/model/cubes/mandata_captate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
---
cubes:
- name: mandata_captate
description: Auto-generated from public.order
sql_table: public.order
measures:
- name: count
type: count
- meta:
ecto_field: customer_id
ecto_type: integer
name: customer_id_sum
type: sum
sql: customer_id
- meta:
ecto_field: customer_id
ecto_type: integer
name: customer_id_distinct
type: count_distinct
sql: customer_id
- meta:
ecto_field: total_amount
ecto_type: integer
name: total_amount_sum
type: sum
sql: total_amount
- meta:
ecto_field: total_amount
ecto_type: integer
name: total_amount_distinct
type: count_distinct
sql: total_amount
- meta:
ecto_field: tax_amount
ecto_type: integer
name: tax_amount_sum
type: sum
sql: tax_amount
- meta:
ecto_field: tax_amount
ecto_type: integer
name: tax_amount_distinct
type: count_distinct
sql: tax_amount
- meta:
ecto_field: subtotal_amount
ecto_type: integer
name: subtotal_amount_sum
type: sum
sql: subtotal_amount
- meta:
ecto_field: subtotal_amount
ecto_type: integer
name: subtotal_amount_distinct
type: count_distinct
sql: subtotal_amount
- meta:
ecto_field: discount_total_amount
ecto_type: integer
name: discount_total_amount_sum
type: sum
sql: discount_total_amount
- meta:
ecto_field: discount_total_amount
ecto_type: integer
name: discount_total_amount_distinct
type: count_distinct
sql: discount_total_amount
- meta:
ecto_field: delivery_subtotal_amount
ecto_type: integer
name: delivery_subtotal_amount_sum
type: sum
sql: delivery_subtotal_amount
- meta:
ecto_field: delivery_subtotal_amount
ecto_type: integer
name: delivery_subtotal_amount_distinct
type: count_distinct
sql: delivery_subtotal_amount
dimensions:
- meta:
ecto_field: market_code
ecto_field_type: string
name: market_code
type: string
sql: market_code
- meta:
ecto_field: brand_code
ecto_field_type: string
name: brand_code
type: string
sql: brand_code
- meta:
ecto_field: payment_reference
ecto_field_type: string
name: payment_reference
type: string
sql: payment_reference
- meta:
ecto_field: fulfillment_status
ecto_field_type: string
name: fulfillment_status
type: string
sql: fulfillment_status
- meta:
ecto_field: financial_status
ecto_field_type: string
name: financial_status
type: string
sql: financial_status
- meta:
ecto_field: email
ecto_field_type: string
name: email
type: string
sql: email
- meta:
ecto_field: updated_at
ecto_field_type: naive_datetime
name: updated_at
type: time
sql: updated_at
- meta:
ecto_field: inserted_at
ecto_field_type: naive_datetime
name: inserted_at
type: time
sql: inserted_at
pre_aggregations:
- external: true
name: public_order_automatic_for_the_people
type: rollup
measures:
- count
- customer_id_sum
- customer_id_distinct
- total_amount_sum
- total_amount_distinct
- tax_amount_sum
- tax_amount_distinct
- subtotal_amount_sum
- subtotal_amount_distinct
- discount_total_amount_sum
- discount_total_amount_distinct
- delivery_subtotal_amount_sum
- delivery_subtotal_amount_distinct
dimensions:
- market_code
- brand_code
- payment_reference
- fulfillment_status
- financial_status
- email
refresh_key:
sql: SELECT MAX(id) FROM public.order
time_dimension: updated_at
granularity: hour
build_range_start:
sql: "SELECT NOW() - INTERVAL '1 year'"
build_range_end:
sql: SELECT NOW()
Loading
Loading