Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhangyuan/mc-cli
A CLI for querying and executing SQL statements against MaxCompute (ODPS).
https://github.com/zhangyuan/mc-cli
Last synced: about 1 month ago
JSON representation
A CLI for querying and executing SQL statements against MaxCompute (ODPS).
- Host: GitHub
- URL: https://github.com/zhangyuan/mc-cli
- Owner: zhangyuan
- License: mit
- Created: 2024-05-27T17:16:25.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T02:58:10.000Z (7 months ago)
- Last Synced: 2024-10-27T14:35:29.229Z (3 months ago)
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mc-cli
## Usage
### Setup the credentials
Create the `.env` file with the sample content as below:
```env
DSN=http://ACCESS_KEY_ID:[email protected]/api?project=project_name
```If multiple SQL statements will be executed, `odps.sql.submit.mode=script` must be set. So the DSN would be like:
```env
DSN=http://ACCESS_KEY_ID:[email protected]/api?project=project_name&odps.sql.submit.mode=script
```### Query the data via single SQL statement
```bash
./mc-cli query -s "SELECT 1"
```or use the SQL from file:
```bash
./mc-cli query -f sample.sql
```Variables in the same style as Dataworks ODPS node are supported via `--dataworks-vars|-v` or `dataworks-vars-file|-d`. E.g.
```bash
./mc-cli query -f sample.sql -d sample.yaml
```### Execute SQL statement(s)
```bash
./mc-cli exec -f sample.sql
```or
```bash
./mc-cli exec -f sample.sql -d sample.yaml
```