Python - sql()
Creates a reference to a SQL database.
from nitric.resources import sqldatabase = sql("database")
Parameters
- Name
name
- Required
- Required
- Type
- string
- Description
The unique name of this database within the project.
- Name
migrations
- Optional
- Optional
- Type
- string
- Description
Points to the location of migration files, prefixed with
file://
, or a migration dockerfile, prefixed withdockerfile://
.
Examples
Create a reference to a database
from nitric.resources import sqldatabase = sql("database")
With a migrations directory
from nitric.resources import sqldatabase = sql("database", migrations="file://migrations")
With a migrations dockerfile
from nitric.resources import sqldatabase = sql("database", migrations="dockerfile://migrations.dockerfile")
See also
Last updated on Dec 5, 2024