Skip to content

nirdosh17/python-api-using-duckdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containerized Python API using DuckDB

Sample Containerized Python API using DuckDB

Flask API

The service exposes GET http://localhost:8080/stats api which returns aggregated user count from DuckDB database test.duckdb.

API response:

[
	{
		"date": "2021-02-20",
		"users_joined": 2598
	},
	{
		"date": "2021-02-21",
		"users_joined": 2578
	}
]

Running without docker

make run

Running as a container

# 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