Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a76d88f
add the python instruqt files
eduardknezovic May 9, 2025
f82d735
add more meaningful message to first
eduardknezovic May 9, 2025
6ec9388
update other messages too
eduardknezovic May 9, 2025
ddf5f20
add more code
eduardknezovic May 30, 2025
1e0b3da
add empty for test
eduardknezovic May 30, 2025
8856fbe
update steps
eduardknezovic Jun 3, 2025
92d1839
final code updates for py1
eduardknezovic Jun 3, 2025
d93c8be
update the code
eduardknezovic Jun 8, 2025
36dba02
update files etc
eduardknezovic Jun 8, 2025
67c40dd
add the new python files to instruqt folder
eduardknezovic Jun 8, 2025
61bc792
move to challenge folder
eduardknezovic Jun 11, 2025
8e2364e
add more challenges:
eduardknezovic Jun 12, 2025
fbcda24
create rust examples
eduardknezovic Jun 15, 2025
96c0e0b
remove the folder
eduardknezovic Jun 15, 2025
5efdc33
add the steps
eduardknezovic Jun 22, 2025
11c92dd
update the java 3 pom file
eduardknezovic Jun 22, 2025
b3365d3
updated the examples
eduardknezovic Jun 22, 2025
10ec9b8
updates
eduardknezovic Jun 23, 2025
b3a3fb8
update the scripts with solutions
eduardknezovic Jun 26, 2025
7eeebb3
updated code
eduardknezovic Jul 13, 2025
e9666d3
Merge branch 'master' of https://github.com/scylladb/scylla-code-samples
eduardknezovic Jul 14, 2025
afb9e1d
Merge branch 'master' into java-testcontainers
eduardknezovic Jul 14, 2025
f130b84
update code
eduardknezovic Jul 14, 2025
103806b
more code
eduardknezovic Jul 14, 2025
1e58484
code changes
eduardknezovic Jul 14, 2025
9ab6b9c
new diff
eduardknezovic Jul 14, 2025
c7526bd
working scala
eduardknezovic Jul 14, 2025
dab7e71
update scala files"
eduardknezovic Jul 14, 2025
2149a77
scala code works
eduardknezovic Jul 14, 2025
308f381
update challenges
eduardknezovic Jul 15, 2025
94ad410
update the keyspace
eduardknezovic Jul 15, 2025
2eecf87
update the error printing
eduardknezovic Jul 15, 2025
32fa7f3
update the urls
eduardknezovic Jul 18, 2025
78a915a
update java3
eduardknezovic Jul 20, 2025
b1668f1
java3 update
eduardknezovic Jul 20, 2025
115592e
update java
eduardknezovic Jul 21, 2025
e74fb0e
create the instruqt tracks for readme
eduardknezovic Jul 24, 2025
4c0aa74
update the readme
eduardknezovic Jul 24, 2025
a9b194b
add one more item
eduardknezovic Jul 24, 2025
fc07dbe
fix grammar mistake
eduardknezovic Aug 5, 2025
25cd2d1
fix the go 2 challenge
eduardknezovic Aug 5, 2025
acd6224
add more instruqt
eduardknezovic Aug 10, 2025
7d9b2d8
rename folder
eduardknezovic Aug 10, 2025
a43066a
update features
eduardknezovic Aug 21, 2025
639db5c
remove files
eduardknezovic Aug 21, 2025
366fa40
add"
eduardknezovic Aug 21, 2025
bdc961a
Convert scylladb-feature-store from submodule to regular directory
eduardknezovic Aug 21, 2025
1794984
remove useless cli
eduardknezovic Aug 21, 2025
0f73e62
fix the version in docker compose
eduardknezovic Aug 21, 2025
3a9c0dc
update version
eduardknezovic Aug 21, 2025
28e84c6
add empty for test
eduardknezovic May 30, 2025
dafee25
update steps
eduardknezovic Jun 3, 2025
7c7de31
final code updates for py1
eduardknezovic Jun 3, 2025
c2cc331
update the code
eduardknezovic Jun 8, 2025
912dce9
update files etc
eduardknezovic Jun 8, 2025
b436ef6
add the new python files to instruqt folder
eduardknezovic Jun 8, 2025
680e167
move to challenge folder
eduardknezovic Jun 11, 2025
a0daac8
add more challenges:
eduardknezovic Jun 12, 2025
707caea
create rust examples
eduardknezovic Jun 15, 2025
585ecf7
remove the folder
eduardknezovic Jun 15, 2025
6596d0d
add the steps
eduardknezovic Jun 22, 2025
7460e8c
update the java 3 pom file
eduardknezovic Jun 22, 2025
86a635f
updated the examples
eduardknezovic Jun 22, 2025
3c71f1e
updates
eduardknezovic Jun 23, 2025
68cf2f0
update the scripts with solutions
eduardknezovic Jun 26, 2025
32f5714
updated code
eduardknezovic Jul 13, 2025
f498968
update code
eduardknezovic Jul 14, 2025
18b8cdd
more code
eduardknezovic Jul 14, 2025
9e1aa41
code changes
eduardknezovic Jul 14, 2025
0545834
new diff
eduardknezovic Jul 14, 2025
31275a0
working scala
eduardknezovic Jul 14, 2025
b20a45d
update scala files"
eduardknezovic Jul 14, 2025
f394784
scala code works
eduardknezovic Jul 14, 2025
690c114
update challenges
eduardknezovic Jul 15, 2025
90c90b8
update the keyspace
eduardknezovic Jul 15, 2025
2ee22ba
update the error printing
eduardknezovic Jul 15, 2025
a971f17
update the urls
eduardknezovic Jul 18, 2025
c703d39
update java3
eduardknezovic Jul 20, 2025
72be9c5
java3 update
eduardknezovic Jul 20, 2025
cf7c216
update java
eduardknezovic Jul 21, 2025
1c3c4d9
create the instruqt tracks for readme
eduardknezovic Jul 24, 2025
9f4208a
update the readme
eduardknezovic Jul 24, 2025
54c625a
add one more item
eduardknezovic Jul 24, 2025
0873061
fix grammar mistake
eduardknezovic Aug 5, 2025
56cf55e
fix the go 2 challenge
eduardknezovic Aug 5, 2025
f623af2
add more instruqt
eduardknezovic Aug 10, 2025
365ff2e
rename folder
eduardknezovic Aug 10, 2025
9acb25b
update features
eduardknezovic Aug 21, 2025
80cd523
remove files
eduardknezovic Aug 21, 2025
60e36a6
add"
eduardknezovic Aug 21, 2025
bfc6388
Convert scylladb-feature-store from submodule to regular directory
eduardknezovic Aug 21, 2025
7b5666a
remove useless cli
eduardknezovic Aug 21, 2025
a70fcef
fix the version in docker compose
eduardknezovic Aug 21, 2025
39e3eb3
update version
eduardknezovic Aug 21, 2025
cfc85f3
Merge branch 'java-testcontainers' of github.com:eduardknezovic/scyll…
eduardknezovic Sep 18, 2025
a6ab8d3
update the docker versions
eduardknezovic Sep 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ buildNumber.properties
presto/resources/etc/node.properties
presto/.docker

*/venv
**/venv/
**/venv/**

*/node_modules

!java-testcontainers/gradle/wrapper/*
6 changes: 3 additions & 3 deletions CDC_Kafka_Lab/docker-compose-scylladb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ version: "3"
services:
scylla-node1:
container_name: scylla-node1
image: scylladb/scylla:5.2.0
image: scylladb/scylla:2025.3
ports:
- 9042:9042
restart: always
command: --seeds=scylla-node1,scylla-node2 --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0

scylla-node2:
container_name: scylla-node2
image: scylladb/scylla:5.2.0
image: scylladb/scylla:2025.3
restart: always
command: --seeds=scylla-node1,scylla-node2 --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0

scylla-node3:
container_name: scylla-node3
image: scylladb/scylla:5.2.0
image: scylladb/scylla:2025.3
restart: always
command: --seeds=scylla-node1,scylla-node2 --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0
2 changes: 1 addition & 1 deletion Rust_CDRS/ps-logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Instructions for setting up a one node Scylla cluster in Docker and running an e
### Starting a Scylla Cluster
To get Scylla up and running start a local scylla instance on port 9042:
```bash
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:5.2.0 --smp 1 --memory=750M --overprovisioned 1
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:2025.3 --smp 1 --memory=750M --overprovisioned 1
```

### Running the RUST Application
Expand Down
2 changes: 1 addition & 1 deletion Rust_Scylla_Driver/chat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ An example application that demonstrates advanced topics such as prepared statem
To get Scylla up and running start a local scylla instance on port 9042:

```bash
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:5.2.0 --smp 1 --memory=750M --overprovisioned 1
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:2025.3 --smp 1 --memory=750M --overprovisioned 1
```

### Running the Rust Application
Expand Down
2 changes: 1 addition & 1 deletion Rust_Scylla_Driver/ps-logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Instructions for setting up a one node Scylla cluster in Docker and running an e
To get Scylla up and running start a local scylla instance on port 9042:

```bash
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:5.2.0 --smp 1 --memory=750M --overprovisioned 1
docker run -p 9042:9042/tcp --name some-scylla --hostname some-scylla -d scylladb/scylla:2025.3 --smp 1 --memory=750M --overprovisioned 1
```

### Running the RUST Application
Expand Down
2 changes: 1 addition & 1 deletion alternator/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Instructions for setting up a one node Scylla cluster and performing some basic
### Starting a Scylla Cluster
To get Scylla up and running with Alternator enabled, start a local scylla instance:
```bash
docker run --name some-scylla --hostname some-scylla -p 8000:8000 -d scylladb/scylla:5.2.0 --smp 1 --memory=750M --overprovisioned 1 --alternator-port=8000
docker run --name some-scylla --hostname some-scylla -p 8000:8000 -d scylladb/scylla:2025.3 --smp 1 --memory=750M --overprovisioned 1 --alternator-port=8000
```

### Installing the Boto 3 Python library
Expand Down
2 changes: 2 additions & 0 deletions alternator/getting-started/read.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import print_function
import boto3

dynamodb = boto3.resource('dynamodb',endpoint_url='http://172.17.0.2:8000',
region_name='None', aws_access_key_id='None', aws_secret_access_key='None')

Expand All @@ -8,6 +9,7 @@
'mutant_data' : { 'Keys': [{ 'last_name': 'Loblaw' }, {'last_name': 'Jeffries'}] }
}
)

for x in response:
print (x)
for y in response[x]:
Expand Down
2 changes: 1 addition & 1 deletion alternator/tictactoe_example_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Example:

You can easily get an Alternator instance started by running the following:

docker run --name scylladb-alternator scylladb/scylla:5.2.0 --smp 1 --memory 512M --alternator-port 8000 --alternator-write-isolation always
docker run --name scylladb-alternator scylladb/scylla:2025.3 --smp 1 --memory 512M --alternator-port 8000 --alternator-write-isolation always
sleep 1m
yourAlternatorIP="$(docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' scylladb-alternator)"
# then you can run the application.py passing variable $yourAlternatorIP
51 changes: 51 additions & 0 deletions instruqt-examples/INSTRUQT_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

# Instruqt README

The purpose of the code in this folder is to provide coding examples and challenges
to the Instruqt tracks related to drivers of particular programming languages.

Currently existing only on the fork of the `scylla-code-samples` from `eduardknezovic` in the `java-testcontainers` branch.

## How to get and update the code

```
git clone https://github.com/eduardknezovic/scylla-code-samples
git checkout java-testcontainers
cd scylla-code-samples/instruqt-examples
```

And from there, the procedure for updating is standard for git flow.

```
git add .
git commit -am "message"
git push
```

## How to update the code on Instruqt VM

After we've updated the version control on GitHub, we need to update the Instruqt VM.

Instruqt VM

1. Go to https://play.instruqt.com/manage/scylladb/host-images
2. Select scylladb/scylladb-6-1-1 by Tim Koopmans
3. Select "Edit"
4. On "Step 1" press "Next"
5. Wait for few minutes for terminal appear on the "Step 2"
6. Run `cd eduard-scylla-code-samples/scylla-code-samples`
7. Run `git pull`
8. Press "Save" button (in the top right corner)
9. Wait for a few minutes, once done the code will be updated for Instruqt tracks

### Important note

There is a folder `~/instruqt-examples` that's used for all of the Instruqt tracks.

This is actually a shortcut (more specifically, a symbolic link) that points to:
`~/eduard-scylla-code-samples/scylla-code-samples/instruqt-examples`

So, when the `~/eduard-scylla-code-samples/scylla-code-samples/instruqt-examples`
gets updated by running `git pull`, the `~/instruqt-examples` folder gets updated, too!

This was done to improve terminal readability for learners going through the Instruqt tracks.
31 changes: 31 additions & 0 deletions instruqt-examples/alternator-getting-started/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Scylla Alternator Getting Started Example
Instructions for setting up a one node Scylla cluster and performing some basic operations on it using the Alternator API. More info in the Scylla University Course [Scylla Alternator](https://university.scylladb.com/courses/scylla-alternator/lessons/dynamodb-api-compatibility-project-alternator-basics/).

### Starting a Scylla Cluster
To get Scylla up and running with Alternator enabled, start a local scylla instance:
```bash
docker run --name some-scylla --hostname some-scylla -p 8000:8000 -d scylladb/scylla:2025.3 --smp 1 --memory=750M --overprovisioned 1 --alternator-port=8000
```

### Installing the Boto 3 Python library
Next, if you don’t already have it set up, install boto3 python library which also contains drivers for DynamoDB:
```bash
sudo pip install --upgrade boto3
```

### Running the Example Application
The application connects to the Scylla cluster, creates a table, inserts two rows into the created table and reads those two rows from the database.
In the three scripts create.py read.py and write.py change the value for “endpoint_url” to the IP address of the node.
To run it:
```bash
python create.py
python write.py
python read.py
```

### Destroying the Scylla Cluster
```bash
docker-compose kill
docker-compose rm -f
```

25 changes: 25 additions & 0 deletions instruqt-examples/alternator-getting-started/create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import print_function
import boto3
dynamodb = boto3.resource('dynamodb',endpoint_url='http://172.17.0.2:8000',
region_name='None', aws_access_key_id='None', aws_secret_access_key='None')

table = dynamodb.create_table(
BillingMode='PAY_PER_REQUEST',
TableName='mutant_data',
KeySchema=[
{
'AttributeName': 'last_name',
'KeyType': 'HASH'
},
],
AttributeDefinitions=[
{
'AttributeName': 'last_name',
'AttributeType': 'S'
},
]
)

print("Finished creating table ", table.table_name ,". Status: ", table.table_status)


17 changes: 17 additions & 0 deletions instruqt-examples/alternator-getting-started/read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import print_function
import boto3

dynamodb = boto3.resource('dynamodb',endpoint_url='http://172.17.0.2:8000',
region_name='None', aws_access_key_id='None', aws_secret_access_key='None')

response = dynamodb.batch_get_item(
RequestItems={
'mutant_data' : { 'Keys': [{ 'last_name': 'Loblaw' }, {'last_name': 'Jeffries'}] }
}
)

for x in response:
print (x)
for y in response[x]:
print (y,':',response[x][y])

30 changes: 30 additions & 0 deletions instruqt-examples/alternator-getting-started/write.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import boto3
dynamodb = boto3.resource('dynamodb',endpoint_url='http://172.17.0.2:8000',
region_name='None', aws_access_key_id='None', aws_secret_access_key='None')

dynamodb.batch_write_item(RequestItems={
'mutant_data': [
{
'PutRequest': {
'Item': {
"last_name": "Loblaw",
"first_name": "Bob",
"address": "1313 Mockingbird Lane"
}
}
},
{
'PutRequest': {
'Item': {
"last_name": "Jeffries",
"first_name": "Jim",
"address": "1211 Hollywood Lane"
}
}
}
]
})

table = dynamodb.Table('mutant_data')
print("Finished writing to table ", table.table_name)

61 changes: 61 additions & 0 deletions instruqt-examples/cpp/part1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Scylla CPP Driver
Instructions for setting up a three node Scylla cluster in Docker and running an example CPP application that interacts with the cluster and performs simple queries. This example uses the [CPP Driver](https://github.com/scylladb/cpp-driver)
More info in the Scylla University Course [Using Scylla Drivers](https://university.scylladb.com/courses/using-scylla-drivers/).

### ### Instructions for setting up a Scylla Cluster from this repo.
```
cd mms
docker-compose up -d
```

Run bash in the node:
```
docker exec -it mms_scylla-node1_1 bash
```

Followed by scylla commands, like
```
> nodetool status
```
or
```
> cqlsh
```

### To manually add the tracking keyspace and data
docker exec -it mms_scylla-node1_1 cqlsh
CREATE KEYSPACE ks WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy','DC1' : 3};
use ks;
CREATE TABLE IF NOT EXISTS catalog.mutant_data (
first_name text,
last_name text,
address text,
picture_location text,
PRIMARY KEY((first_name, last_name)));
INSERT INTO catalog.mutant_data ("first_name","last_name","address","picture_location") VALUES ('Bob','Loblaw','1313 Mockingbird Lane', 'https://tinyurl.com/bobloblaw123');
INSERT INTO catalog.mutant_data ("first_name","last_name","address","picture_location") VALUES ('Bob','Zemuda','1202 Coffman Lane', 'https://tinyurl.com/bobzemuda');


### Running the CPP Example
The application uses [CPP Driver](https://github.com/scylladb/cpp-driver) which is an open-source Scylla driver for CPP. Start by installing the driver, you can read more about installation in the [Scylla University lesson CPP Driver – Part 1](https://university.scylladb.com/courses/using-scylla-drivers/lessons/cpp-driver-part-1/)
To connect to a cluster, edit the file connect.cpp and change the IP according to the setup of your cluster. Now compile and run the code:
```bash
g++ connect.cpp -lscylla-cpp-driver -o connect
./connect
```

To run a simple query, edit the file query.cpp and change the IP according to the setup of your cluster. Now compile and run the code:
```bash
g++ query.cpp -lscylla-cpp-driver -o query
./query
```

### Destroying the Scylla Cluster
```
cd mms
docker-compose kill
docker-compose rm -f
```



56 changes: 56 additions & 0 deletions instruqt-examples/cpp/part1/challenge.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <cassandra.h>
#include <iostream>

int main(int argc, char* argv[]) {
CassCluster* cluster = cass_cluster_new();
CassSession* session = cass_session_new();

cass_cluster_set_contact_points(cluster, "localhost");

CassFuture* connect_future = cass_session_connect(session, cluster);

if (cass_future_error_code(connect_future) == CASS_OK) {
std::cout << "Connected" << std::endl;

const char* query = ""; // TODO: write the select query here

// if query is empty, print error message
if (query == NULL) {
std::cout << "Error: query is empty, you need to write the query" << std::endl;
return 1;
}

CassStatement* statement = cass_statement_new(query, 0);

CassFuture* result_future = cass_session_execute(session, statement);

if (cass_future_error_code(result_future) == CASS_OK) {
const CassResult* result = cass_future_get_result(result_future);
CassIterator* iterator = cass_iterator_from_result(result);


while (cass_iterator_next(iterator)) {
const CassRow* row = cass_iterator_get_row(iterator);

const CassValue* value = cass_row_get_column_by_name(row, "first_name");
const char* first_name;
size_t first_name_length;
cass_value_get_string(value, &first_name, &first_name_length);
std::cout.write(first_name, first_name_length);
std::cout << '\n';
}
cass_iterator_free(iterator);
cass_result_free(result);
} else {
}

cass_statement_free(statement);
cass_future_free(result_future);
} else {
std::cout << "Connection ERROR" << std::endl;
}

cass_future_free(connect_future);
cass_cluster_free(cluster);
cass_session_free(session);
}
Binary file added instruqt-examples/cpp/part1/connect
Binary file not shown.
Loading