CSV sample
A short excerpt of the CSV we imported into SQLite (the full file is in the project):fake_data inside a SQLite file named fakeData.db. After creating the DB and importing the CSV, the database UI looked like this:

fakeData.db saved and verified, the next step is building a small API that can either query the fake_data table or generate additional fake records on demand.
Quick DB helper (SQLAlchemy)
We use SQLAlchemy to obtain DB sessions inside FastAPI routes. Create a simple DB helper that exposes aget_db dependency for route injection:
get_db() in endpoints that need to query the fake_data table (example wiring is listed in “Next steps” below).
Choosing a Python web framework
FastAPI was selected for this project due to its performance, developer ergonomics, and automatic OpenAPI docs. Flask and Django are valid alternatives depending on project needs:
An annotated comparison screenshot used during exploration:

Project scaffold
A minimal project layout used for this example:main.py — start the FastAPI app
A minimalmain.py that mounts the router and runs via Uvicorn:
python main.py will raise an import error:
Request model (Pydantic)
Use a Pydantic model to validate incoming POST requests for fake-data generation:Router and generating fake data (no third-party Faker)
To keep dependencies minimal, this project uses simple Python-based generators rather than the externalfaker library. The API exposes a POST endpoint /getfakedata which maps data_type to a generator function:
data_type and the generator function.
Supported data types and generators:
Example request / response
Send a POST to/getfakedata with JSON:
data_type example (400 response):
Running and testing
Start the app:- POST
http://localhost:8000/getfakedatawith JSON shown above. - Visit
http://localhost:8000/docsfor automatically generated OpenAPI docs.
When using Copilot or any code generator, treat the output as a draft: validate imports, run tests, and adapt generated code to your project structure (packages, relative imports, DB paths). In this example we intentionally replaced external Faker usage with small local generators to reduce dependencies and keep full control over output.
Next steps (wiring DB queries and expanding features)
Suggested enhancements to connect the API to the SQLite dataset and make it production-ready:- Wire endpoints to query
fake_datausingget_db()(SQLAlchemy session). Example pattern: - Add query parameters or dedicated endpoints for filtering (by city, age, occupation), sorting, and pagination.
- Add unit tests for endpoints and generator functions (pytest).
- Add API documentation notes and curated OpenAPI examples (FastAPI supports
response_modelandexamples). - Consider using SQLAlchemy models to map
fake_datarows to ORM objects for cleaner queries.
Links and references
- FastAPI docs: https://fastapi.tiangolo.com/
- SQLAlchemy: https://www.sqlalchemy.org/
- SQLite: https://www.sqlite.org/docs.html
- Pydantic: https://docs.pydantic.dev/