We are developing the backend of an invoicing system. The system can receive two types of messages:
- HEADER [invoice_id, invoice_date, invoice_address]
- DETAIL [invoice_id, line_id, article_name, article_price]
The messages can arrive in any order (e.g. a DETAIL message can arrive before the corresponding HEADER message arrives).
We store both the header and the detail information in a single table called invoice
.
- Fix the create script in the
01-create-script.sql
file so that both the upsert statements from the02-upsert-readonly.sql
file and the select statements in the03-query-readonly.sql
can be executed without changes. - Fix the queries in the
04-query-fix.sql
file so that they work as expected.
There are two easy ways to use Cassandra on your computer, detailed under the following chapters.
Important: Install the latest version (at least 3.4).
Download the tarball from here, and unpack it to any folder.
Go to the bin
folder of the unpacked Cassandra, and execute the following commands.
# Start cassandra service (if it is not started yet)
cassandra
# Start the CQL shell
cqlsh
It is very easy to run cassandra with Docker. The cassandra service is automatically started within the container, so you just need to start the CQL shell.
# Pull latest release
docker pull cassandra
# Create a cassandra container named cc
docker run --name cc -d cassandra
# Start a CQL shell within the container
docker exec -it cc cqlsh