Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Support for Cube.dev #855

Merged
merged 25 commits into from
Mar 12, 2024
Merged
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
124 changes: 124 additions & 0 deletions .github/workflows/integration-cube-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Cube Integration CI

on:
pull_request:
paths:
- "grai-integrations/source-cube/**"
- "grai-client/**"
- "grai-server/**"


concurrency:
group: ${{ github.ref }}-integration-cube-ci
cancel-in-progress: true

env:
py_ver: "3.10"
poetry_ver: "1.3.1"
project_dir: "grai-integrations/source-cube"

jobs:
lint-integration-cube:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.project_dir }}
steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Install Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "${{ env.py_ver }}"

- run: pip install black isort

- run: |
black . --check
isort . --profile black --check

tests-integration-cube:
needs: lint-integration-cube
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.project_dir }}
# services:
# grai-db:
# image: postgres:16
# env:
# POSTGRES_USER: grai
# POSTGRES_PASSWORD: grai
# POSTGRES_DB: grai
# ports:
# - 5433:5432
# # needed because the postgres container does not provide a healthcheck
# options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15
# db:
# image: postgres:16
# env:
# POSTGRES_USER: cube
# POSTGRES_PASSWORD: cube
# POSTGRES_DB: cube
# ports:
# - 5434:5432
# # needed because the postgres container does not provide a healthcheck
# options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15
# cubeapi:
# image: cubejs/cube:latest
# volumes:
# - ${{ github.workspace }}/grai-integrations/source-cube/data/cube:/cube/conf
# ports:
# - 4000:4000
# env:
# CUBEJS_DB_TYPE: postgres
# CUBEJS_DB_HOST: db
# CUBEJS_DB_NAME: cube
# CUBEJS_DB_USER: cube
# CUBEJS_DB_PASS: cube
# CUBEJS_API_SECRET: secret
# CUBEJS_DATASOURCES: default,grai
# CUBEJS_DS_GRAI_DB_TYPE: postgres
# CUBEJS_DS_GRAI_DB_HOST: grai-db
# CUBEJS_DS_GRAI_DB_PORT: "5432"
# CUBEJS_DS_GRAI_DB_NAME: grai
# CUBEJS_DS_GRAI_DB_USER: grai
# CUBEJS_DS_GRAI_DB_PASS: grai
# CUBEJS_DEV_MODE: true
steps:

- uses: actions/checkout@v4

- name: Start Cube Stack
run: |
docker compose up -d

- uses: actions/setup-python@v5
with:
python-version: "${{ env.py_ver }}"

- uses: abatilo/actions-poetry@v2
with:
poetry-version: "${{ env.poetry_ver }}"

# - name: Set up Postgres db
# working-directory: ${{ env.project_dir }}/data/dev-database
# env:
# POSTGRES_USER: grai
# POSTGRES_PASSWORD: grai
# POSTGRES_DB: grai
# PORT: 5433
# HOST: grai-db
# run: |
# bash init-db.sh

- run: poetry install

- name: Wait for Cube to start
run: |
docker run --network container:cubeapi curlimages/curl -s --retry 10 --retry-connrefused http://localhost:4000/readyz

- name: Run Cube Tests
run: poetry run pytest
1 change: 1 addition & 0 deletions .github/workflows/integration-postgres-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 15
steps:
- uses: actions/checkout@v4

- name: Set up Postgres db
working-directory: ${{ env.project_dir }}/dev-database
env:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ repos:
# - flake8-bugbear
# - flake8-comprehensions
# - flake8-simplify

- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
Expand Down
28 changes: 28 additions & 0 deletions docs/components/Integrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,33 @@ const KeboolaIcon = (props: { height: number; width: number }) => {
);
};

const CubeIcon = (props: { height: number; width: number }) => {
const height = props.height || defaultHeight;
const width = props.width || defaultWidth;

return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={width}
height={height}
viewBox="0 0 256 296"
version="1.1"
preserveAspectRatio="xMidYMid"
>
<g>
<polygon fill="#FF6492" points="256 74.2490728 128.031649 0 128.031649 51.3772356 256 125.299266 256 74.238523"></polygon>
<polygon fill="#141446" points="256 125.299266 217.609495 147.696365 128 95.8021924 76.8021099 125.341465 38.401055 104.590126 128.021099 51.3772356 256 125.299266"></polygon>
<polygon fill="#A14474" points="76.8021099 125.341465 38.401055 104.590126 38.401055 147.696365"></polygon>
<polygon fill="#141446" points="1.87401035e-14 221.143658 128 147.696365 256 221.143658 128 295.392731"></polygon>
<polygon fill="#FF6492" points="256 170.167312 128 95.0004121 128 147.696365 256 221.143658"></polygon>
<polygon fill="#7A77FF" points="38.401055 147.696365 38.401055 104.590126 128.021099 51.3772356 128.021099 0 9.37005174e-15 74.2490728 9.37005174e-15 221.143658 128 147.696365 128 95.0004121"></polygon>
</g>
</svg>
);
};




export {
BigQueryLogoIcon,
Expand All @@ -2045,4 +2072,5 @@ export {
SparkLogo,
KeboolaLogo,
KeboolaIcon,
CubeIcon,
};
2 changes: 1 addition & 1 deletion docs/pages/api-docs/_meta.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"grai_cli": "grai_cli", "grai_client": "grai_client", "grai_graph": "grai_graph", "grai_schemas": "grai_schemas", "grai_source_bigquery": "grai_source_bigquery", "grai_source_dbt": "grai_source_dbt", "grai_source_dbt_cloud": "grai_source_dbt_cloud", "grai_source_fivetran": "grai_source_fivetran", "grai_source_flat_file": "grai_source_flat_file", "grai_source_looker": "grai_source_looker", "grai_source_metabase": "grai_source_metabase", "grai_source_mssql": "grai_source_mssql", "grai_source_mysql": "grai_source_mysql", "grai_source_postgres": "grai_source_postgres", "grai_source_redshift": "grai_source_redshift", "grai_source_snowflake": "grai_source_snowflake"
"grai_cli": "grai_cli", "grai_client": "grai_client", "grai_graph": "grai_graph", "grai_schemas": "grai_schemas", "grai_source_bigquery": "grai_source_bigquery", "grai_source_cube": "grai_source_cube", "grai_source_dbt": "grai_source_dbt", "grai_source_dbt_cloud": "grai_source_dbt_cloud", "grai_source_fivetran": "grai_source_fivetran", "grai_source_flat_file": "grai_source_flat_file", "grai_source_looker": "grai_source_looker", "grai_source_metabase": "grai_source_metabase", "grai_source_mssql": "grai_source_mssql", "grai_source_mysql": "grai_source_mysql", "grai_source_openlineage": "grai_source_openlineage", "grai_source_postgres": "grai_source_postgres", "grai_source_redshift": "grai_source_redshift", "grai_source_snowflake": "grai_source_snowflake"
}
1 change: 1 addition & 0 deletions docs/pages/api-docs/grai_cli/api/server/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ NOTE: Not all request parameters are supported by the REST api. See the document
- `namespace` - The namespace of the node to retrieve. By default it will not search and specific namespace.
- `print` - Print the search response to the console. Defaults to True.
- `to_file` - Path to write the search response to. Does not write by default.
- `**kwargs` - Additional kwargs to pass to the search.


**Returns**:
Expand Down
53 changes: 53 additions & 0 deletions docs/pages/api-docs/grai_graph/graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,56 @@ def build_graph(nodes: List[Dict], edges: List[Dict], version: str) -> Graph


**Returns**:



## BaseSourceSegment Objects

```python
class BaseSourceSegment()
```

### \_\_init\_\_

```python
def __init__(node_source_map: Dict[UUID, Iterable[str]],
edge_map: Dict[UUID, Sequence[UUID]])
```

**Attributes**:

- `node_source_map` - A dictionary mapping between node id&#x27;s and the set of source labels for the node
- `node_map` - A dictionary mapping source node id&#x27;s to destination node id&#x27;s

### covering\_set

```python
@cached_property
def covering_set() -> tuple[CoveringSourceSet]
```

**Returns**:

A tuple of all covering sources

### node\_cover\_map

```python
@cached_property
def node_cover_map() -> Dict[UUID, str]
```

**Returns**:

A mapping between node id&#x27;s and their covering source label

### cover\_edge\_map

```python
@cached_property
def cover_edge_map() -> Dict[str, List[str]]
```

**Returns**:

A mapping between covering source labels and covering destination labels
Loading
Loading