Skip to content

Conversation

igorbenav
Copy link
Collaborator

Closes #84

If you want to stop tables from being created every time you run the api, you should disable this here:

# app/main.py

from .api import router
from .core.config import settings
from .core.setup import create_application

# create_tables_on_start defaults to True
app = create_application(router=router, settings=settings, create_tables_on_start=False)

This create_application function is defined in app/core/setup.py, and it's a flexible way to configure the behavior of your application.

A few examples:

  • Deactivate or password protect /docs
  • Add client-side cache middleware
  • Add Startup and Shutdown event handlers for cache, queue and rate limit

@igorbenav igorbenav added the enhancement New feature or request label Dec 31, 2023
@igorbenav igorbenav self-assigned this Dec 31, 2023
@igorbenav igorbenav linked an issue Dec 31, 2023 that may be closed by this pull request
@igorbenav igorbenav merged commit af87f0e into main Dec 31, 2023
@igorbenav igorbenav deleted the 84-disable-automatic-table-creation branch December 31, 2023 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable automatic table creation

1 participant