-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a SQL support documentation #522
base: master
Are you sure you want to change the base?
Changes from all commits
8091105
37fb44c
348988c
e5151bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## INSERT Statements | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the doc for INSERT as well according to my review comments above 🙇 |
||
|
||
``` | ||
INSERT INTO data_location select_statement; | ||
``` | ||
|
||
#### Where `data_directory` is a sub-directory pointing to the `rootDirectory` of your configuration file | ||
```sql | ||
-- example | ||
INSERT INTO `gdax_BTC-USD/1D/OHLCV` SELECT * FROM `binance_BTC-USDT/1D/OHLCV`; | ||
``` | ||
|
||
### Aggregate functions supported: | ||
- TICKCANDLER |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## SELECT Statements | ||
|
||
``` | ||
SELECT [ ALL | DISTINCT ] select_expr [, ...] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I'm not sure if |
||
[ FROM data_directory [, ...] ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [imo] |
||
[ WHERE condition ] | ||
[ { LIMIT [ count ] } ] | ||
``` | ||
|
||
#### Where `data_directory` is a sub-directory pointing to the `rootDirectory` of your configuration file | ||
|
||
``` sql | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think example SQL per each syntax is helpful for readers.
|
||
-- example | ||
SELECT * FROM `gdax_BTC-USD/1D/OHLCV`; --escape dashes by wrapping it with backticks | ||
``` | ||
|
||
#### Aggregate functions supported are the following: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some explanation about aggregate function would be helpful ! Please refer this design doc |
||
- COUNT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some explanation and example aggfunc usage might be helpful for readers.
|
||
- AVG | ||
- MAX | ||
- MIN |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SQL Support | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [imo] Probably readers of this document want to know what SQL support is and how to use it, so how about adding some basic explanation and usage first? and used technologies can be mentioned later. [Usage]
|
||
|
||
The SQL interpreter uses ANTLR4 in order to generate a parse tree and evaluate the given SQL statements within the CLI application. | ||
|
||
In order to achieve this, ANTLR4 requires a lexer file and a grammar file in order to work. The lexer file can be found in `sqlparser/parser/SQLLexerRules.g4` directory and the grammar rules can be found at `sqlparser/parser/SQLBase.g4` directory. | ||
|
||
The SQL grammar is mainly based on Facebook Presto DB. Currently the SQL support is limited to the following Data Manipulation Language since market data is a structured data and highly likely it will stay this way (but contribution is highly recommended if you want to expand the current support): | ||
|
||
- [SELECT statement](./select-statement.md) | ||
- [INSERT statement](./insert-statement.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the following to
README.ja.md
? 🙏