Skip to content

quan-vu/FastAPI-Cassandra-Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Cassandra Demo

A sample python application based on FasiAPI and Cassandra database.

Development

Start Cassandra database

# With cassandra it will take a few minutes to checking that it started up correctly
# Wating for it complete started
make start-db

Start application

make start

Run Unit test

make test

Referance

Cassandra database

https://docs.datastax.com/en/cql-oss/3.x/cql/cql_reference/cqlshShow.html

Working with cassandra database.

Login to cassandra db

cqlsh -u cassandra

Show the version

SHOW VERSION

Get keyspaces info

SELECT * FROM system_schema.keyspaces;

Get tables info

SELECT table_name FROM system_schema.tables WHERE keyspace_name = 'keyspace_organization_db' AND table_name = 'organizations';

Get table info

SELECT * FROM system_schema.columns WHERE keyspace_name = 'keyspace_organization_db' AND table_name = 'organizations';

Select table data

SELECT * FROM keyspace_organization_db.organizations;

Drop table

DROP TABLE keyspace_organization_db.organizations;