Skip to content

Commit 362db5d

Browse files
authored
Rework examples based on latest SQRL standards, introduce shared data catalogs (#113)
1 parent 154ee48 commit 362db5d

212 files changed

Lines changed: 548 additions & 34983 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ concurrency:
2323

2424
env:
2525
TZ: 'America/Los_Angeles'
26-
SQRL_VERSION: '0.10.7'
26+
SQRL_VERSION: '0.10.8'
2727

2828
jobs:
2929
build-and-push:
@@ -44,46 +44,46 @@ jobs:
4444
compile recommendation_package_kafka.json
4545
4646
- example: credit-card-analytics
47-
path: finance-credit-card-chatbot/credit-card-analytics
47+
path: finance-credit-card-chatbot
4848
tag: credit-card-analytics
4949
test_commands: |
50-
compile creditcard_analytics_package_test.json
51-
compile creditcard_analytics_package_kafka.json
52-
test creditcard_analytics_package_test.json creditcard_analytics_package_jwt.json
50+
compile credit-card-analytics/creditcard_analytics_package_test.json
51+
compile credit-card-analytics/creditcard_analytics_package_kafka.json
52+
test creditcard_analytics_package_test.json creditcard_analytics_package_jwt.json -r credit-card-analytics
5353
- example: credit-card-rewards
54-
path: finance-credit-card-chatbot/credit-card-rewards
54+
path: finance-credit-card-chatbot
5555
tag: credit-card-rewards
5656
test_commands: |
57-
compile creditcard_rewards_package_test.json
58-
compile creditcard_rewards_package_kafka.json
59-
test creditcard_rewards_package_test.json creditcard_rewards_package_jwt.json
57+
compile credit-card-rewards/creditcard_rewards_package_test.json
58+
compile credit-card-rewards/creditcard_rewards_package_kafka.json
59+
test creditcard_rewards_package_test.json creditcard_rewards_package_jwt.json -r credit-card-rewards
6060
- example: credit-card-views
61-
path: finance-credit-card-chatbot/credit-card-views
61+
path: finance-credit-card-chatbot
6262
tag: credit-card-views
6363
test_commands: |
64-
compile creditcard_views_package_test.json
65-
test creditcard_views_package_test.json
64+
compile credit-card-views/creditcard_views_package_test.json
65+
test credit-card-views/creditcard_views_package_test.json
6666
6767
- example: healthcare-study-analytics
68-
path: healthcare-study/healthcare-study-analytics
68+
path: healthcare-study
6969
tag: healthcare-study-analytics
7070
test_commands: |
71-
compile study_analytics_package_test.json
72-
test study_analytics_package_test.json
71+
compile healthcare-study-analytics/study_analytics_package_test.json
72+
test healthcare-study-analytics/study_analytics_package_test.json
7373
- example: healthcare-study-api
74-
path: healthcare-study/healthcare-study-api
74+
path: healthcare-study
7575
tag: healthcare-study-api
7676
test_commands: |
77-
compile study_api_package_api.json
78-
compile study_api_package_test.json
79-
test study_api_package_test.json
77+
compile healthcare-study-api/study_api_package_api.json
78+
compile healthcare-study-api/study_api_package_test.json
79+
test healthcare-study-api/study_api_package_test.json
8080
- example: healthcare-study-stream
81-
path: healthcare-study/healthcare-study-stream
81+
path: healthcare-study
8282
tag: healthcare-study-stream
8383
test_commands: |
84-
compile study_stream_package_kafka.json
85-
compile study_stream_package_test.json
86-
test study_stream_package_test.json
84+
compile healthcare-study-stream/study_stream_package_kafka.json
85+
compile healthcare-study-stream/study_stream_package_test.json
86+
test healthcare-study-stream/study_stream_package_test.json
8787
8888
- example: iceberg-dedup
8989
path: iceberg-data-deduplication
@@ -112,16 +112,16 @@ jobs:
112112
test logistics_package_test.json
113113
114114
- example: oil-gas-monitoring
115-
path: oil-gas-agent-automation/oil-gas-agent-monitoring
115+
path: oil-gas-agent-automation
116116
tag: oil-gas-agent-monitoring
117117
test_commands: |
118-
compile monitoring_agent_package_test.json
118+
compile oil-gas-agent-monitoring/monitoring_agent_package_test.json
119119
- example: oil-gas-operations
120-
path: oil-gas-agent-automation/oil-gas-agent-operations
120+
path: oil-gas-agent-automation
121121
tag: oil-gas-agent-operations
122122
test_commands: |
123-
compile operations_agent_package_test.json
124-
test operations_agent_package_test.json
123+
compile oil-gas-agent-operations/operations_agent_package_test.json
124+
test oil-gas-agent-operations/operations_agent_package_test.json
125125
126126
- example: usage-analytics
127127
path: usage-analytics
@@ -232,7 +232,7 @@ jobs:
232232
-e AWS_SESSION_TOKEN \
233233
-e AWS_REGION \
234234
-e AWS_DEFAULT_REGION \
235-
--rm -v "$PWD":/build "$SQRL_IMAGE" $cmd
235+
--rm -v "$PWD":/workspace "$SQRL_IMAGE" $cmd
236236
echo "::endgroup::"
237237
done
238238
@@ -244,8 +244,8 @@ jobs:
244244
cat <<EOF > ${{ matrix.path }}/Dockerfile
245245
FROM ${SQRL_IMAGE}
246246
247-
COPY . /build
248-
WORKDIR /build
247+
COPY . /workspace
248+
WORKDIR /workspace
249249
EOF
250250
251251
- name: Set up QEMU
@@ -277,7 +277,7 @@ jobs:
277277
name: Lint GraphQL Schemas
278278
runs-on: ubuntu-latest
279279
steps:
280-
- uses: actions/checkout@v4
280+
- uses: actions/checkout@v6
281281

282282
- name: Lint GraphQL schemas
283283
run: |

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ To compile and run these examples with DataSQRL you need to have a [recent versi
2121

2222
To run the examples on Linux or MacOS, open a terminal and run the following command:
2323
```bash
24-
docker run -it --rm -p 8888:8888 -p 8081:8081 -p 9092:9092 -v $PWD:/build datasqrl/cmd:latest run [ARGUMENTS GO HERE]
24+
docker run -it --rm -p 8888:8888 -p 8081:8081 -p 9092:9092 -v $PWD:/workspace datasqrl/cmd:latest run [ARGUMENTS GO HERE]
2525
```
2626

2727
If you are on windows using Powershell, you need to reference the local directory with a slightly different syntax:
2828
```bash
29-
docker run -it --rm -p 8888:8888 -p 8081:8081 -p 9092:9092 -v $PWD:/build datasqrl/cmd:latest run [ARGUMENTS GO HERE]
29+
docker run -it --rm -p 8888:8888 -p 8081:8081 -p 9092:9092 -v $PWD:/workspace datasqrl/cmd:latest run [ARGUMENTS GO HERE]
3030
```
3131

3232
Check the `README.md` in the respective directory for more information on the arguments to run each example.
3333
We will be using the Unix syntax, so keep in mind that you have to adjust the commands slightly on Windows machines by using `${PWD}` instead.
3434

3535
To compile an example (without running it), use this command:
3636
```bash
37-
docker run -it --rm -v $PWD:/build datasqrl/cmd:latest compile [ARGUMENTS GO HERE]
37+
docker run -it --rm -v $PWD:/workspace datasqrl/cmd:latest compile [ARGUMENTS GO HERE]
3838
```
3939

4040
## What is DataSQRL?

clickstream-ai-recommendation/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This version allows you to add content and clickstream data manually through a G
2525

2626
Run the API version with this command:
2727
```bash
28-
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/build -e OPENAI_API_KEY=[YOUR_API_KEY_HERE] datasqrl/cmd:latest run -c recommendation_package_api.json
28+
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/workspace -e OPENAI_API_KEY=[YOUR_API_KEY_HERE] datasqrl/cmd:latest run -c recommendation_package_api.json
2929
```
3030

3131
Next, open [GraphQL Explorer](http://localhost:8888/v1/graphiql/) and add some content:
@@ -79,7 +79,7 @@ data through a Kafka connector.
7979

8080
To run the pipeline:
8181
```bash
82-
docker run -it -p 8081:8081 -p 8888:8888 -p 9092:9092 --rm -v $PWD:/build -e OPENAI_API_KEY=[YOUR_API_KEY_HERE] datasqrl/cmd:latest run -c recommendation_package_kafka.json
82+
docker run -it -p 8081:8081 -p 8888:8888 -p 9092:9092 --rm -v $PWD:/workspace -e OPENAI_API_KEY=[YOUR_API_KEY_HERE] datasqrl/cmd:latest run -c recommendation_package_kafka.json
8383
```
8484

8585
1. Once everything is started, open another terminal window to add data to Kafka using the

clickstream-ai-recommendation/clickstream-api/clickstream.sqrl

Lines changed: 0 additions & 6 deletions
This file was deleted.

clickstream-ai-recommendation/clickstream-kafka/clickstream.sqrl

Lines changed: 0 additions & 14 deletions
This file was deleted.

clickstream-ai-recommendation/content-api/content.sqrl renamed to clickstream-ai-recommendation/connectors/api.sqrl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*+ engine(kafka) */
2+
CREATE TABLE Clickstream (
3+
url STRING NOT NULL,
4+
userid STRING NOT NULL,
5+
event_time TIMESTAMP_LTZ(3) NOT NULL METADATA FROM 'timestamp'
6+
);
7+
18
/*+ engine(kafka) */
29
CREATE TABLE Content (
310
url STRING NOT NULL,

clickstream-ai-recommendation/content-kafka/content.sqrl renamed to clickstream-ai-recommendation/connectors/kafka.sqrl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
CREATE TABLE Clickstream (
2+
url STRING NOT NULL,
3+
userid STRING NOT NULL,
4+
event_time TIMESTAMP_LTZ(3) NOT NULL METADATA FROM 'timestamp',
5+
WATERMARK FOR event_time AS event_time - INTERVAL '0.001' SECOND
6+
) WITH (
7+
'connector' = 'kafka',
8+
'topic' = 'clickstream',
9+
'properties.bootstrap.servers' = '${KAFKA_BOOTSTRAP_SERVERS}',
10+
'properties.group.id' = 'clickstream-group',
11+
'scan.startup.mode' = 'group-offsets',
12+
'properties.auto.offset.reset' = 'earliest',
13+
'format' = 'flexible-json'
14+
);
15+
116
CREATE TABLE Content (
217
url STRING NOT NULL,
318
title STRING NOT NULL,
@@ -12,4 +27,4 @@ CREATE TABLE Content (
1227
'scan.startup.mode' = 'group-offsets',
1328
'properties.auto.offset.reset' = 'earliest',
1429
'format' = 'flexible-json'
15-
);
30+
);

clickstream-ai-recommendation/content-api/sample_content.jsonl renamed to clickstream-ai-recommendation/connectors/testdata/sample_content.jsonl

File renamed without changes.

clickstream-ai-recommendation/recommendation.sqrl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/*+no_query */
2-
IMPORT clickstream-{{variant}}.clickstream.*;
3-
4-
/*+no_query */
5-
IMPORT content-{{variant}}.content.*;
2+
IMPORT connectors.{{variant}}.*;
63

74
/* Find next page visits within 10 minutes */
85
_CoVisits := SELECT b.url AS beforeURL, a.url AS afterURL,

finance-credit-card-chatbot/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package JSON filename) - the instructions are otherwise identical.
2424
To run this example, invoke the following command in the example directory on Unix based systems to compile the project:
2525
```bash
2626
cd credit-card-analytics
27-
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/build datasqrl/cmd:latest run -c creditcard_analytics_package_test.json
27+
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/workspace datasqrl/cmd:latest run -c creditcard_analytics_package_test.json
2828
```
2929

3030
This command stands up the API using [DataSQRL](https://www.datasqrl.com/), a development tool
@@ -42,7 +42,7 @@ To use Kafka as the data source, follow these steps:
4242
Invoke the following command in the example directory:
4343
```bash
4444
cd credit-card-analytics
45-
docker run -it -p 8081:8081 -p 8888:8888 -p 9092:9092 --rm -v $PWD:/build datasqrl/cmd:latest run -c creditcard_analytics_package_kafka.json
45+
docker run -it -p 8081:8081 -p 8888:8888 -p 9092:9092 --rm -v $PWD:/workspace datasqrl/cmd:latest run -c creditcard_analytics_package_kafka.json
4646
```
4747

4848
This command stands up the entire data pipeline and all data services, including Kafka.
@@ -76,7 +76,7 @@ any of the main package configurations to secure the endpoints, regardless of ot
7676
For example, to secure the API with the File data source, invoke the following command in the specific example directory:
7777
```bash
7878
cd credit-card-analytics
79-
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/build datasqrl/cmd:latest run \
79+
docker run -it -p 8081:8081 -p 8888:8888 --rm -v $PWD:/workspace datasqrl/cmd:latest run \
8080
-c creditcard_analytics_package_test.json \
8181
-c creditcard_analytics_package_jwt.json
8282
```

0 commit comments

Comments
 (0)