Skip to content

Commit

Permalink
Framework/Streamlit: Add information about connecting to CrateDB Cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 27, 2024
1 parent ba6ef8a commit 891a656
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
13 changes: 13 additions & 0 deletions framework/streamlit/.streamlit/secrets-cratedb-cloud.toml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions framework/streamlit/.streamlit/secrets.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
15 changes: 13 additions & 2 deletions framework/streamlit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
```

0 comments on commit 891a656

Please sign in to comment.