Docs / Guides / Multi-database

Feature 02 · Study guide

Multi-database

Choose SQLite, PostgreSQL, MySQL, or MongoDB — and learn how tamilPY stores and uses that choice.

What you will learn
  • Which databases tamilPY supports
  • How the build wizard writes .env and schema
  • How to switch providers later with tpy db configure

1. Supported providers

ProviderBest forNotes
sqliteLearning / local demosNo server; file-based
postgresProduction SQLFull FK / indexes
mysqlProduction SQLSame CRUD path
mongodbDocumentsCollections + indexes; refs are metadata

2. Setup during build

$ tpy build

The wizard asks for provider, host, port, user, and password. It writes:

  • .env — connection URL / credentials
  • tpy.toml — app settings
  • schema.tpy — optional database … line
$ pip install "tamilPY[all]"   # SQL + Mongo drivers
$ pip install "tamilPY[redis]" # Redis cache/queue

3. Reconfigure later

$ tpy db configure
$ tpy db info
$ tpy db ping

info prints the active provider and URL shape. ping opens a real connection so you know credentials work before migrate.

4. How the runtime uses it

Providers are selected from config. Generated repositories call the active provider for SQL/Mongo operations. You usually do not import drivers yourself inside controllers.

5. Common mistakes

  • Installing the framework without DB extras, then wondering why Postgres fails to import.
  • Changing only schema.tpy database line without updating .env.