| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
sgr is the CLI for Splitgraph, a serverless API for data-driven Web applications.
With addition of the optional sgr Engine component, sgr can become a stand-alone tool for building, versioning and querying reproducible datasets. We use it as the storage engine for Splitgraph. It's inspired by Docker and Git, so it feels familiar. And it's powered by PostgreSQL, so it works seamlessly with existing tools in the Postgres ecosystem. Use sgr to package your data into self-contained Splitgraph data images that you can share with other sgr instances.
To install the sgr CLI or a local sgr Engine, see the Installation section of this readme.
Splitfiles give you a declarative language, inspired by Dockerfiles, for expressing data transformations in ordinary SQL familiar to any researcher or business analyst. You can reference other images, or even other databases, with a simple JOIN.
When you build data images with Splitfiles, you get provenance tracking of the resulting data: it's possible to find out what sources went into every dataset and know when to rebuild it if the sources ever change. You can easily integrate sgr your existing CI pipelines, to keep your data up-to-date and stay on top of changes to upstream sources.
Splitgraph images are also version-controlled, and you can manipulate them with Git-like operations through a CLI. You can check out any image into a PostgreSQL schema and interact with it using any PostgreSQL client. sgr will capture your changes to the data, and then you can commit them as delta-compressed changesets that you can package into new images.
sgr supports PostgreSQL foreign data wrappers. We call this feature mounting. With mounting, you can query other databases (like PostgreSQL/MongoDB/MySQL) or open data providers (like Socrata) from your sgr instance with plain SQL. You can even snapshot the results or use them in Splitfiles.
The code in this repository contains:
We also recommend reading our Blog, including some of our favorite posts:
Pre-requisites:
You can get the sgr single binary from the releases page. Optionally, you can run sgr engine add to create an engine.
For Linux and OSX, once Docker is running, install sgr with a single script:
$ bash -c "$(curl -sL https://github.com/splitgraph/sgr/releases/latest/download/install.sh)"This will download the sgr binary and set up the sgr Engine Docker container.
See the installation guide for more installation methods.
You can follow the quick start guide that will guide you through the basics of using sgr with Splitgraph or standalone.
Alternatively, sgr comes with plenty of examples to get you started.
If you're stuck or have any questions, check out the documentation or join our Discord channel!
The test suite requires docker-compose. You will also need to add these lines to your /etc/hosts or equivalent:
127.0.0.1 local_engine 127.0.0.1 remote_engine 127.0.0.1 objectstorage
To run the core test suite, do
docker-compose -f test/architecture/docker-compose.core.yml up -d poetry run pytest -m "not mounting and not example"
To run the test suite related to "mounting" and importing data from other databases (PostgreSQL, MySQL, Mongo), do
docker-compose -f test/architecture/docker-compose.core.yml -f test/architecture/docker-compose.mounting.yml up -d poetry run pytest -m mounting
Finally, to test the example projects, do
# Example projects spin up their own engines docker-compose -f test/architecture/docker-compose.core.yml -f test/architecture/docker-compose.core.yml down -v poetry run pytest -m example
All of these tests run in CI.
| Back | FazBrowse Home | New Git URL |