https://github.com/pwildenhain/run-sql-dsn
Run sql scripts given an ODBC data source name
https://github.com/pwildenhain/run-sql-dsn
Last synced: 3 months ago
JSON representation
Run sql scripts given an ODBC data source name
- Host: GitHub
- URL: https://github.com/pwildenhain/run-sql-dsn
- Owner: pwildenhain
- Created: 2020-08-03T23:13:52.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T20:35:05.000Z (over 4 years ago)
- Last Synced: 2025-06-04T16:19:00.775Z (4 months ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# run-sql-dsn
## Installation
Install from GitHub:
```
$ pip install --user git+https://github.com/pwildenhain/run-sql-dsn#egg=run-sql-dsn
```Install shell completion
```
$ sql --install-completion
```_Note: Windows users may need to manually modify paths in shell config files_
## Usage
Create an ODBC data source name (DSN). The setup will be OS dependent. Google is your friend :nerd_face:
Run a sql query:
```
$ sql run "select * from my_table" MY_DSN
+----------+----------+
| column_1 | column_2 |
+==========+==========+
| a | 1 |
+----------+----------+
| b | 2 |
+----------+----------+
| c | 3 |
+----------+----------+
```Or a sql file:
```
$ sql run-file test.sql MY_DSN
+----------+----------+
| column_1 | column_2 |
+==========+==========+
| a | 1 |
+----------+----------+
| b | 2 |
+----------+----------+
| c | 3 |
+----------+----------+
```Set a default DSN with the `RUN_SQL_DSN` environment variable:
```
$ export RUN_SQL_DSN=MY_DSN
$ sql run-file test.sql
+----------+----------+
| column_1 | column_2 |
+==========+==========+
| a | 1 |
+----------+----------+
| b | 2 |
+----------+----------+
| c | 3 |
+----------+----------+
```See `sql run --help` and `sql run-file --help` for a full list of CLI options.