You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/integrate/superset/sandbox.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
# Set up an Apache Superset development sandbox with CrateDB
3
3
4
4
## Introduction
5
-
This is a little walkthrough about how to quickly spawn a development sandbox with Apache Superset, in order to work on the CrateDB Python driver with live code reloading.
5
+
This is a little walkthrough about how to quickly spawn a development sandbox with Apache Superset, in order to work on the CrateDB SQLAlchemy dialect with live code reloading.
6
6
7
7
## Prerequisites
8
8
You will need Bash, Docker, Git, and Python to be installed on your workstation. All other prerequisites will be installed into your working tree.
@@ -12,12 +12,12 @@ You will need Bash, Docker, Git, and Python to be installed on your workstation.
12
12
### CrateDB
13
13
14
14
Start CrateDB using Docker.
15
-
```console
15
+
```shell
16
16
docker run --rm --publish=4200:4200 --publish=5432:5432 --name=cratedb --env CRATE_HEAP_SIZE=1g crate:latest -Cdiscovery.type=single-node
17
17
```
18
18
19
19
Create an example table and insert a single record.
20
-
```console
20
+
```shell
21
21
docker run --interactive --rm --network=host crate:latest crash <<EOF
22
22
CREATE TABLE IF NOT EXISTS testdrive (
23
23
ts TIMESTAMP,
@@ -38,7 +38,7 @@ If you need more data to explore, follow [how to load 2.6M records from the NYC
38
38
39
39
#### Install Apache Superset from source
40
40
You can copy this whole section verbatim into your terminal.
In order to link the filesystem location of the Python driver into the sandbox environment, install the package in ["editable" mode](https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs).
If you don't have the sources yet, you can obtain them from the Git repository using `git clone https://github.com/crate/sqlalchemy-cratedb`.
68
68
69
69
#### Start backend
70
70
By using the `--reload` option, changes on the Python code will be automatically picked up.
71
-
```console
71
+
```shell
72
72
# Invoke development web server with code reload machinery.
73
73
FLASK_ENV=development superset run -p 8088 --with-threads --reload --debugger
74
74
```
75
75
76
76
#### Build and start frontend
77
77
In another console, but also within the same virtualenv, you will need to build the frontend and run its development web server.
78
-
```console
78
+
```shell
79
79
source .venv/bin/activate
80
80
cd superset-frontend
81
81
npm install
@@ -89,11 +89,11 @@ npm run dev-server
89
89
You should be ready to go. Now,
90
90
91
91
- navigate to `http://localhost:4200/#!/console` for exploring the CrateDB Admin UI.
92
-
- navigate to `http://localhost:9000/superset/sqllab/` for exploring your data in Apache Superset, log in with admin/admin.
92
+
- navigate to `http://localhost:8088/superset/sqllab/` for exploring your data in Apache Superset, log in with admin/admin.
93
93
94
94
### Create a database connection
95
95
For creating a database connection to CrateDB in Apache Superset, you can either use the user interface, or the HTTP API. Those steps will create the connection using the HTTP API, saving a few clicks and keystrokes.
Copy file name to clipboardExpand all lines: docs/integrate/superset/usage.md
+13-8Lines changed: 13 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ You will need Bash, Docker, and Python to be installed on your workstation. All
12
12
## Install
13
13
14
14
Set up a Python environment, and install and configure Apache Superset. You can locate the installation within an arbitrary folder on your workstation, for example `~/dev/cratedb-superset`.
You need to create a `superset_config.py` file, to configure an individual `SECRET_KEY` for your application.
25
-
```console
25
+
```shell
26
26
echo"SECRET_KEY = '$(docker run --rm alpine/openssl rand -base64 42)'"> superset_config.py
27
27
```
28
28
29
29
This sequence of commands initializes the metadata database at `~/.superset/superset.db`, and provisions a superuser account.
30
-
```console
30
+
```shell
31
31
# Configure and initialize Apache Superset.
32
32
export FLASK_APP=superset
33
33
export SUPERSET_CONFIG_PATH=superset_config.py
@@ -39,7 +39,7 @@ superset init
39
39
## Start services
40
40
41
41
Start CrateDB using Docker.
42
-
```console
42
+
```shell
43
43
docker run --interactive --rm --pull=always \
44
44
--publish=4200:4200 --publish=5432:5432 \
45
45
--name=cratedb \
@@ -48,7 +48,7 @@ docker run --interactive --rm --pull=always \
48
48
```
49
49
50
50
Run Superset server.
51
-
```console
51
+
```shell
52
52
superset run --port=9000 --with-threads
53
53
```
54
54
@@ -57,7 +57,7 @@ superset run --port=9000 --with-threads
57
57
Import six million records worth of data from the venerable NYC Yellowcab taxi ride dataset. Depending on the speed of the internet connection between the location of your database instance, and AWS S3, where data is loaded from, it may take about one minute of time.
58
58
59
59
This is a one-shot command using the [crash](https://cratedb.com/docs/crate/crash/) database shell running in a Docker container, which includes a relevant SQL DDL statement to create the database table schema, and a `COPY FROM` statement to import data from a compressed JSON file located on AWS S3.
60
-
```console
60
+
```shell
61
61
docker run --interactive --rm --network=host crate:latest crash <<EOF
62
62
DROP TABLE IF EXISTS yellowcab;
63
63
CREATE TABLE yellowcab (
@@ -112,7 +112,7 @@ In order to work with data in Apache Superset, before being able to create dashb
112
112
Using [Apache Superset's HTTP API](https://superset.apache.org/docs/api), you can automate the provisioning process. The commands outlined below are using [HTTPie](https://httpie.io/docs/cli) for that purpose, saving a few clicks and keystrokes.
0 commit comments