https://github.com/augmentable-dev/flite
SQLite extension and command line utility for working with various forms of local data files
https://github.com/augmentable-dev/flite
Last synced: about 2 months ago
JSON representation
SQLite extension and command line utility for working with various forms of local data files
- Host: GitHub
- URL: https://github.com/augmentable-dev/flite
- Owner: augmentable-dev
- License: mit
- Created: 2021-04-08T00:39:37.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-29T00:18:55.000Z (over 4 years ago)
- Last Synced: 2024-06-21T01:40:48.065Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 2.25 MB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/augmentable-dev/flite)
[](https://goreportcard.com/report/github.com/augmentable-dev/flite)
[](https://codecov.io/gh/augmentable-dev/flite)
# flite
`flite` is a SQLite extension and command line utility for working with local data files.
It's meant to work in tandem with built-in functionality such as the [SQLite JSON1 extension](https://www.sqlite.org/json1.html).
## Usage
### SQLite Extension
`flite` can be compiled to a shared library and be loaded as a SQLite [runtime extension](https://sqlite.org/loadext.html).
Run `make` and the shared library will available be at `./build/flite.so`.
### Command Line Interface
`make` will also produce a binary at `./build/flite`.
## lines
`split` is an [eponoymous-only virtual table](https://www.sqlite.org/vtab.html#eponymous_only_virtual_tables) (table-valued-function) that reads a file from disk (or stdin if no file is specified) and splits it into rows by a delimiter (defaults to `\n`).
```sql
SELECT * FROM split("/path/to/some/file.ndjson")
```
## file_read
`file_read` is a scalar function that returns the contents of a file (path provided as an argument).
If no path is supplied, it reads from stdin.
```sql
SELECT file_read("/path/to/file.json")
```
## yaml_to_json
`yaml_to_json` is a scalar function that expects a single argument (a YAML string) and returns it as a JSON string (which can be used in the built-in JSON methods)
```sql
SELECT yaml_to_json("hello: world")
-- {"hello":"world"}
```
## json_to_yaml
`json_to_yaml` is a scalar function that expects a single argument (a JSON string) and returns it as a YAML string.
```sql
SELECT json_to_yaml('{"hello":"world"}')
-- hello: world
```