forked from scylladb/scylla-rust-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloud.rs
29 lines (24 loc) · 796 Bytes
/
cloud.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use std::env;
use std::path::Path;
use anyhow::Result;
use scylla::CloudSessionBuilder;
#[tokio::main]
async fn main() -> Result<()> {
println!("Connecting to SNI proxy as described in cloud config yaml ...");
let config_path = env::args()
.nth(1)
.unwrap_or("examples/config_data.yaml".to_owned());
let session = CloudSessionBuilder::new(Path::new(&config_path))
.unwrap()
.build()
.await
.unwrap();
session.query("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}",
&[]).await.unwrap();
session
.query("DROP TABLE IF EXISTS examples_ks.cloud;", &[])
.await
.unwrap();
println!("Ok.");
Ok(())
}