Anant example-cassandra-presto-airflow
License: No License Provided
Language: Python
Learn how to connect Airflow, Presto, and Cassandra all on your browser via Gitpod! This demo can also be done on your local via Docker.
IMPORTANT: Remember to make the ports public when the dialog shows in the bottom righthand corner!
bash setup.sh
docker ps
username: admin
password: password
hostname -I | awk '{print $2}'
Connection Type: Presto
Host: value copied from 3.1
Schema: remove hive and leave blank
Login: admin
Port: 8080
sed -i "s/{hostname}/$(hostname -I | awk '{print $2}')/" cassandra.properties
docker cp cassandra.properties $(docker container ls | grep 'presto' | awk '{print $1}'):/opt/presto-server/etc/catalog/cassandra.properties
docker exec -it presto sh -c "ls /opt/presto-server/etc/catalog"
docker exec -it presto presto-cli
show catalogs ;
If you do not see cassandra, then we need to restart the container
docker restart presto
docker cp setup.cql $(docker container ls | grep 'cassandra' | awk '{print $1}'):/
docker exec -it cassandra cqlsh -f setup.cql
mkdir ~/airflow/dags && mv presto_read_from_cassandra.py ~/airflow/dags && mv presto_join_and_xcom.py ~/airflow/dags && mv presto_write_to_cassandra.py ~/airflow/dags
key: presto_query
value: select * from cassandra.demo.spacecraft_journey_catalog;
select cassandra.demo.spacecraft_journey_catalog.spacecraft_name, cassandra.demo.spacecraft_journey_catalog.summary, cassandra.demo.spacecraft_speed_over_time.speed from cassandra.demo.spacecraft_journey_catalog inner join cassandra.demo.spacecraft_speed_over_time on cassandra.demo.spacecraft_journey_catalog.journey_id = cassandra.demo.spacecraft_speed_over_time.journey_id;
docker exec -it cassandra cqlsh -e "select * from demo.spacecraft_journey_summary_and_speed"
Join Our Newsletter!
Sign up below to receive email updates and see what's going on with our company.