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
Follow build guide in README to install dependencies and build an initial build. Once complete, Open 2 terminal sessions in the root of this repo.
4
+
5
+
In one session run the back end in development mode
6
+
7
+
```sh
8
+
npm start --prefix server
9
+
```
10
+
11
+
In the other start the development server for the front end.
12
+
13
+
```sh
14
+
npm start --prefix client
15
+
```
16
+
17
+
At this point you should have both back end and front end development servers running.
18
+
19
+
http://localhost:3000 serves React-based frontend in dev-mode
20
+
http://localhost:3010 serves frontend compiled for production
21
+
22
+
When viewing the front end in development mode, the page will automatically refresh on client file changes. The back end server will auto-restart on back end file changes as well.
23
+
24
+
When viewing SQLPad in dev-mode in port 3000, some features may not work correctly (like csv/xlsx downloads, google auth). This is likely due to the port difference in configuration (google auth can only redirect to 1 url/port) or the dev-mode proxy setup (React dev mode is served by a secondary web server that will proxy requests it doesn't understand to the SQLPad server running on 3010 during development.)
25
+
26
+
ESLint and Prettier are used to enforce code patterns and formatting in this project. A precommit hook should enforce and warn about these checks. If that is not set up however you may find these terminal commands useful.
27
+
28
+
```sh
29
+
# To check lint
30
+
npm run lint
31
+
32
+
# To fix (some) errors and formatting automatically
33
+
npm run fixlint
34
+
```
35
+
36
+
### Mock driver
37
+
38
+
When SQLPad server is run in debug mode, a mock driver implementation is available to generate data. The data returned by the query run is determined by information parsed from the comment block. The rest of the query may be anything.
39
+
40
+
Measure fields will contain random data.
41
+
42
+
```sql
43
+
-- At least one dimension field is required. MUST include number of unique values
44
+
-- orderdate and orderdatetime should not be used at same time
45
+
-- dimensions = department 10, color 10, product 10, orderdate|orderdatetime 500
46
+
47
+
-- Optional measures
48
+
-- measures = cost, revenue, profit
49
+
50
+
-- Optional order by. MUST be a dimension or measure returned and MUST include direction
Copy file name to clipboardExpand all lines: README.md
+27-78Lines changed: 27 additions & 78 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,42 +4,53 @@
4
4
5
5
A web app for writing and running SQL queries and visualizing the results. Supports Postgres, MySQL, SQL Server, Crate, Vertica, Presto, and SAP HANA. Other databases potentially supported via [unix odbc support](https://github.com/rickbergfalk/sqlpad/wiki/ODBC).
The docker image runs on port 3000 and uses `/var/lib/sqlpad` for the embedded database directory.
14
12
15
-
Some configuration is exposed via environment variables. See [configItems.js](https://github.com/rickbergfalk/sqlpad/blob/master/server/lib/config/configItems.js) for details on environment variables considered (`envVar` field).
13
+
For configuration exposed via environment variables reference [CONFIGURATION.md](https://github.com/rickbergfalk/sqlpad/blob/master/CONFIGURATION.md).
16
14
17
-
See [docker-validation](https://github.com/rickbergfalk/sqlpad/tree/master/docker-validation)folder for example docker-compose setup with SQL Server.
15
+
See [docker-validation](https://github.com/rickbergfalk/sqlpad/tree/master/docker-validation)directory for example docker-compose setup with SQL Server.
18
16
19
17
## Building
20
18
19
+
- Install node 10 or later
21
20
- Clone/download this repo
22
-
- Install node 10 or later ([nvm recommended](https://github.com/creationix/nvm))
23
-
- Ensure you have the latest npm
21
+
- Install dependencies and build the UI
24
22
25
23
```sh
26
-
npm install npm -g
24
+
scripts/build.sh
27
25
```
28
26
29
-
- Install dependencies and build the UI
27
+
The gist of this script is:
30
28
31
29
```sh
32
-
scripts/build.sh
30
+
# install root level dependencies using package-lock.json as reference
31
+
npm ci
32
+
# install front-end dependencies using package-lock.json
33
+
cd client
34
+
npm ci
35
+
# build front-end
36
+
npm run build
37
+
# install back-end dependencies
38
+
cd ../server
39
+
npm ci
40
+
cd ..
41
+
# copy client build to server directory
42
+
mkdir server/public
43
+
cp -r client/build/* server/public
33
44
```
34
45
35
-
At this point you can run the SQLPad server with the frontend built for production use:
46
+
At this point you can run the SQLPad server with the front-end built for production use:
If prefered, SQLPad can be installed as a global module using the local files in this repo. This allows running SQLPad via the cli in any directory, just as if you had installed it with `npm install sqlpad -g`
53
+
If prefered, SQLPad can be installed as a global module using the local files in this repo. This allows running SQLPad via the cli in any directory, just as if you had installed it with `npm install sqlpad -g`. Note that you must build and copy the client prior to this step.
A docker image may be built using the Dockerfile located in `server` directory. See `docker-publish.sh` for example docker build command.
54
65
55
-
## Development
56
-
57
-
- Clone/download this repo
58
-
- Install node 8 or later ([nvm recommended](https://github.com/creationix/nvm))
59
-
- Ensure you have the latest npm
60
-
61
-
```sh
62
-
npm install npm -g
63
-
```
66
+
## Configuration
64
67
65
-
- Install dependencies and build the UI
66
-
67
-
```sh
68
-
scripts/build.sh
69
-
```
70
-
71
-
- Open 2 terminal sessions in the root of this repo.
72
-
73
-
In one install the backend dependencies and start the development server
74
-
75
-
```sh
76
-
npm start --prefix server
77
-
```
68
+
[CONFIGURATION.md](CONFIGURATION.md)
78
69
79
-
In the other install frontend dependencies and start the development server
80
-
81
-
```sh
82
-
npm start --prefix client
83
-
```
84
-
85
-
At this point you should have both backend and frontend development servers running.
86
-
87
-
http://localhost:3000 serves React-based frontend in dev-mode
88
-
http://localhost:3010 serves frontend compiled for production
89
-
90
-
When viewing the frontend in development mode, the page will automatically refresh on frontend file change. The backend server will auto-restart on backend file change.
91
-
92
-
ESLint and Prettier are used to enforce code patterns and formatting in this project. A precommit hook should enforce and warn about these checks. If that is not set up however you may find these terminal commands useful.
93
-
94
-
```sh
95
-
# To check lint
96
-
npm run lint
97
-
98
-
# To fix (some) errors and formatting automatically
99
-
npm run fixlint
100
-
```
101
-
102
-
### Mock driver
103
-
104
-
When SQLPad server is run in debug mode, a mock driver implementation is available to generate data. The data returned by the query run is determined by information parsed from the comment block. The rest of the query may be anything.
105
-
106
-
Measure fields will contain random data.
107
-
108
-
```sql
109
-
-- At least one dimension field is required. MUST include number of unique values
110
-
-- orderdate and orderdatetime should not be used at same time
111
-
-- dimensions = department 10, color 10, product 10, orderdate|orderdatetime 500
112
-
113
-
-- Optional measures
114
-
-- measures = cost, revenue, profit
115
-
116
-
-- Optional order by. MUST be a dimension or measure returned and MUST include direction
0 commit comments