Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lcaballero/sql-parser
Given sql in a yaml file this lib parses the yaml and finds sql variable to produce a new version of the yaml file.
https://github.com/lcaballero/sql-parser
Last synced: 23 days ago
JSON representation
Given sql in a yaml file this lib parses the yaml and finds sql variable to produce a new version of the yaml file.
- Host: GitHub
- URL: https://github.com/lcaballero/sql-parser
- Owner: lcaballero
- License: epl-1.0
- Created: 2015-10-20T02:49:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-20T03:05:56.000Z (about 9 years ago)
- Last Synced: 2024-04-14T19:27:35.136Z (9 months ago)
- Language: CoffeeScript
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# Summary
Transforms this:
```YAML
---
namespace: ""
scripts:
- name: "read x from y"
sql: |
select id, title from products where $Price > 10
```into this:
```YAML
---
namespace: ""
scripts:
- name: "read x from y"
vars: [
"$Price"
]
sql: |
select id, title from products where $Price > 10
```# Intoduction
This library parses YAML files in the format shown above, traversing a
top level `scripts` array, where that scripts array contains objects
with a `sql` property.The sql is parsed for variables using the [sqlite-parser][sqlite-parser]
library and those variables are added to that object as `vars`.The result is output to stdout.
# Usage
```
%> sql-parse src/gen-sql.yaml > gen-sql.with-vars.yaml
```## License
See license file.
The use and distribution terms for this software are covered by the
[Eclipse Public License 1.0][EPL-1], which can be found in the file 'license' at the
root of this distribution. By using this software in any fashion, you are
agreeing to be bound by the terms of this license. You must not remove this
notice, or any other, from this software.[EPL-1]: http://opensource.org/licenses/eclipse-1.0.txt
[Sqlite]: https://www.sqlite.org/lang.html
[sqlite-parser]: https://github.com/codeschool/sqlite-parser
[Yamljs]: https://www.npmjs.com/package/yamljs