From 891a6565156d30ee09354759ea11ef52ccd7f1f9 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Wed, 26 Jun 2024 23:16:44 +0200 Subject: [PATCH] Framework/Streamlit: Add information about connecting to CrateDB Cloud --- .../.streamlit/secrets-cratedb-cloud.toml | 13 +++++++++++++ framework/streamlit/.streamlit/secrets.toml | 2 ++ framework/streamlit/README.md | 15 +++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 framework/streamlit/.streamlit/secrets-cratedb-cloud.toml diff --git a/framework/streamlit/.streamlit/secrets-cratedb-cloud.toml b/framework/streamlit/.streamlit/secrets-cratedb-cloud.toml new file mode 100644 index 00000000..3cde509e --- /dev/null +++ b/framework/streamlit/.streamlit/secrets-cratedb-cloud.toml @@ -0,0 +1,13 @@ +# Streamlit secrets file for CrateDB Cloud. +# https://docs.streamlit.io/develop/api-reference/connections/secrets.toml +# .streamlit/secrets.toml + +[connections.cratedb] +dialect = "crate" +host = "example.gke1.us-central1.gcp.cratedb.net" +port = "4200" +username = "admin" +password = "g_,8.F0fNbVSk0.*!n54S5c," + +[connections.cratedb.create_engine_kwargs.connect_args] +ssl = true diff --git a/framework/streamlit/.streamlit/secrets.toml b/framework/streamlit/.streamlit/secrets.toml index f939975d..0eeb42ae 100644 --- a/framework/streamlit/.streamlit/secrets.toml +++ b/framework/streamlit/.streamlit/secrets.toml @@ -1,3 +1,5 @@ +# Streamlit secrets file for CrateDB on localhost. +# https://docs.streamlit.io/develop/api-reference/connections/secrets.toml # .streamlit/secrets.toml [connections.cratedb] diff --git a/framework/streamlit/README.md b/framework/streamlit/README.md index 5569b976..e59fc443 100644 --- a/framework/streamlit/README.md +++ b/framework/streamlit/README.md @@ -9,6 +9,8 @@ Configure database connection address and credentials within make sure to use valid credentials matching your environment. ## Usage + +### CrateDB on localhost To start a CrateDB instance on your machine, invoke: ```shell docker run -it --rm \ @@ -17,6 +19,15 @@ docker run -it --rm \ crate:latest -Cdiscovery.type=single-node ``` +### CrateDB Cloud +Please have a look at the [secrets-cratedb-cloud.toml](.streamlit/secrets-cratedb-cloud.toml) +file as a blueprint. It includes a configuration snippet that is essential for +connecting to CrateDB Cloud. +```toml +[connections.cratedb.create_engine_kwargs.connect_args] +ssl = true +``` + Install dependencies. ```shell pip install -r requirements.txt @@ -36,7 +47,7 @@ Enjoy the list of mountains. ## Development -Acquire `cratedb-example` repository, and set up sandbox: +Acquire `cratedb-example` repository, and set up development sandbox. ```shell git clone https://github.com/crate/cratedb-examples cd cratedb-examples @@ -45,7 +56,7 @@ source .venv/bin/activate pip install -r requirements.txt ``` -Then, invoke the integration test cases: +Invoke the integration test cases. ```shell ngr test framework/streamlit ```