RestBase
RestBase is a Python-based CLI tool that lets you fetch data from any REST API and sync it directly into a PostgreSQL database. It automatically infers table schemas from JSON responses, creates tables, and inserts data — no SQL or ORM required.
🚀 Features
- 🌐 Query parameter support per endpoint
- 🔍 Automatic schema inference from JSON
- 📦 Nested JSON handled as
JSONBcolumns - 🛠 Table creation only if not already present
- ⚡ Fast, minimal CLI
- ✅ Interactive config builder (no manual editing)
📦 Installation
Install directly from PyPI:
pip install restbase-cli
restbase
Or via Python module
python -m restbase
🛠 First-Time Setup
When you first run restbase, it will ask you for:
- API base URL and endpoints
- Optional query parameters
- PostgreSQL credentials
This generates a config.yaml file used for syncing.
🧪 Example config.yaml
api:
base_url: https://api.openbrewerydb.org/v1
headers: {}
endpoints:
- path: /breweries
params:
by_city: san_diego
postgres:
host: localhost
port: 5432
dbname: restbase_db
user: postgres
password: secret
🔧 Tech Stack
- Python 3.7+
- PostgreSQL
- Libraries:
requests,psycopg2-binary,PyYAML
🙋 Contributing
Pull requests are welcome!
To run the project locally:
git clone https://github.com/soumyadeep423/restbase-cli.git
cd restbase-cli
pip install .
pip install -e . #edit mode
restbase
📝 License
Licensed under the MIT License.
📫 Author
Soumyadeep Das GitHub: @soumyadeep423
Metadata
Release files for restbase-cli 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| restbase_cli-0.0.2.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| restbase_cli-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / restbase_cli-0.0.2.tar.gz
| Download URL | restbase_cli-0.0.2.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c12c1461362e4a8de50787277687de679da344bc86a4b754ea4f8c8c44a9ba8
|
|
BLAKE2b-256 checksum How to use checksums |
97bf489e56687718cfea299bd31ee36380fb58d5e1eb76ae49343055460736c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / restbase_cli-0.0.2-py3-none-any.whl
| Download URL | restbase_cli-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccfbea71e3fb485ddb22a54ef2495992d473017097364bc04dbcdcff9aa02497
|
|
BLAKE2b-256 checksum How to use checksums |
4cfdc56d248b979ce0c143e1850e695da8ece7f54a6659a15684a92000cbaf2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|