https://github.com/nirdosh17/python-api-using-duckdb
Sample containerized Python API using DuckDB
https://github.com/nirdosh17/python-api-using-duckdb
containerization duckdb duckdb-database flask flask-api python python3
Last synced: about 1 month ago
JSON representation
Sample containerized Python API using DuckDB
- Host: GitHub
- URL: https://github.com/nirdosh17/python-api-using-duckdb
- Owner: nirdosh17
- Created: 2023-02-21T14:14:50.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-21T14:30:27.000Z (over 3 years ago)
- Last Synced: 2025-06-22T23:02:50.639Z (11 months ago)
- Topics: containerization, duckdb, duckdb-database, flask, flask-api, python, python3
- Language: Python
- Homepage:
- Size: 22.2 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Containerized Python API using DuckDB
Sample Containerized Python API using [DuckDB](https://duckdb.org/)
## Flask API
The service exposes `GET http://localhost:8080/stats` api which returns aggregated user count from DuckDB database `test.duckdb`.
**API response:**
```json
[
{
"date": "2021-02-20",
"users_joined": 2598
},
{
"date": "2021-02-21",
"users_joined": 2578
}
]
```
## Running without docker
```bash
make run
```
## Running as a container
```bash
# builds docker image
make docker.build
# runs docker image
make docker.run
```
## Test Data
Test data is coming from database file `test.duckdb`. It contains a table called `users` which has following fields with ~1 million randomly generated rows:
| id (int32)| joined_date (date) | name (varchar)| email (varchar) |
|-----------|--------------------|---------------|-------------------------|
| 1 | 2021-09-14 | Jarret Kuhn | carsondooley@wolf.name |