Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshlong-attic/bootiful-cassandra
https://github.com/joshlong-attic/bootiful-cassandra
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/joshlong-attic/bootiful-cassandra
- Owner: joshlong-attic
- Created: 2020-10-01T00:44:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T18:22:56.000Z (almost 4 years ago)
- Last Synced: 2024-04-13T19:27:30.986Z (9 months ago)
- Language: Java
- Size: 72.3 KB
- Stars: 5
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Getting Started with DataStax Astra for Cassandra
## 1. Setup ASTRA
- [Create an Astra Instance](https://docs.datastax.com/en/astra/docs/creating-your-astra-database.html)
- Create the Table
Once the database is ready go to CQLConsole and create the table
```sql
CREATE TABLE IF NOT EXISTS starter_orders (
order_id uuid,
product_id uuid,
product_quantity int,
product_name text,
product_price decimal,
added_to_order_at timestamp,
PRIMARY KEY ((order_id), product_id)
) WITH CLUSTERING ORDER BY (product_id DESC);
```- [Create an token](https://docs.datastax.com/en/astra/docs/manage-application-tokens.html) with role `Databse administrator`
## 2. Build ASTRA SDK
```bash
git clone https://github.com/clun/astra-sdk-java.git
cd astra-sdk-java
mvn clean install -Dmaven.test.skip=true```
Then add the SDK client to the pom.xmlL
```
com.datastax.astra
astra-spring-boot-starter
2021.1-SNAPSHOT```
## 3. Setup your application
- Copy the db id, the cloud region and the apptoken in Application.properties
```properties
astra.cloudRegion=us-east-1
astra.databaseId=de9d6c10-c8e6-43f0-95dc-72517cf801ec
astra.applicationToken=AstraCS:lAkKZnycDWcAxCyOiBMdaoie:025dbbb5904xxx
astra.keyspace=bootiful
```## 4. Run TESTS
- Open this application in an IDE
- Open `pom.xml` and check reference to the spring boot starter
```xml
com.datastax.astra
astra-spring-boot-starter
2021.1-SNAPSHOT```
- Start working with `AstraClientTest`
```java
should_list_available_db()
should_create_new_serverless_db()
should_create_cqlSession()
```- Back to the Astra UI create a new KEYSPACE `namespace1`
- Update code to provide namespace name
```java
should_use_documentAPI()
```- Run the Application
```bash
mvn spring-boot:run
```## 5. Check in the DB