-
Notifications
You must be signed in to change notification settings - Fork 1.1k
graph,graphql,server,store: Subgraph Sql Service #5382
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b765438
graph: add sql to schema
gusinacio b365a81
graph, store: create database sql executor
gusinacio 8154735
graph, graphql: add resolver for sql
gusinacio 8844eb5
graphql, store: add parse and validation for custom sql
gusinacio 49949c6
graph, graphql, server, store: convert object_or_interface into query…
gusinacio 86345d8
graph, graphql: add sql service config toggle
gusinacio ee44541
docs: add sql service documentation
gusinacio a1a7c64
store: Use double quotation format for parsed sql tables matched with…
d3bebe7
store: Test validation for use CTE with side effect
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| scalar String | ||
| scalar JSONObject | ||
| scalar SqlVariable | ||
|
|
||
|
|
||
| enum SqlFormat { | ||
| JSON | ||
| CSV | ||
| } | ||
|
|
||
| input SqlInput { | ||
| """ | ||
| The SQL query to execute. The query may contain positional parameters | ||
| that are passed in the `parameters` field. | ||
| """ | ||
| query: String! | ||
| """ | ||
| The SQL query parameters. The parameters are passed to the SQL query | ||
| as positional parameters. The parameters are converted to the SQL | ||
| types based on the GraphQL types of the parameters. | ||
| """ | ||
| parameters: [SqlVariable] | ||
|
|
||
| """ | ||
| The format of the SQL query result. The default format is JSON. | ||
| """ | ||
| format: SqlFormat = JSON | ||
| } | ||
|
|
||
|
|
||
| # The type names are purposely awkward to minimize the risk of them | ||
| # colliding with user-supplied types | ||
| "The type for the top-level sql field" | ||
| type SqlJSONOutput { | ||
| "The columns returned by the query" | ||
| columns: [String!]! | ||
|
|
||
| """ | ||
| The SQL query result row count. | ||
| """ | ||
| rowCount: Int! | ||
|
|
||
| """ | ||
| The SQL query result rows. Each row is represented as a list of values. | ||
| The values are represented as JSON values. | ||
| """ | ||
| rows: [JSONObject!]! | ||
| } | ||
|
|
||
|
|
||
| type SqlCSVOutput { | ||
|
|
||
| "The columns returned by the query" | ||
| columns: [String!]! | ||
|
|
||
| """ | ||
| The SQL query result rows. Represented as a CSV string | ||
| """ | ||
| result: String | ||
| """ | ||
| Number of SQL rows being returned | ||
| """ | ||
| rowCount: Int! | ||
| } | ||
|
|
||
| union SqlOutput = SqlJSONOutput | SqlCSVOutput | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please avoid
*imports - they become a huge headache later in some refactorings. Just list everything you actually need.Also, the single letter crates, like
s,qandrshould always be used as such, i.e., code should always says::Documentinstead of justDocument