| Total Complexity | 0 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
|
|
|||
| 2 | from sqlalchemy.ext.declarative import declarative_base |
||
| 3 | from sqlalchemy.schema import MetaData |
||
| 4 | |||
| 5 | # Recommended naming convention used by Alembic, as various different database |
||
| 6 | # providers will autogenerate vastly different names making migrations more |
||
| 7 | # difficult. See: http://alembic.zzzcomputing.com/en/latest/naming.html |
||
| 8 | NAMING_CONVENTION = { |
||
| 9 | "ix": "ix_%(column_0_label)s", |
||
| 10 | "uq": "uq__%(table_name)s__%(column_0_name)s", # Unique constrains |
||
| 11 | # TODO - G.M - 28-03-2018 - [Database] Convert database to allow naming convention |
||
| 12 | # for ck contraint. |
||
| 13 | # "ck": "ck_%(table_name)s_%(constraint_name)s", |
||
| 14 | "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s", |
||
| 15 | "pk": "pk_%(table_name)s" |
||
| 16 | } |
||
| 17 | |||
| 18 | metadata = MetaData(naming_convention=NAMING_CONVENTION) |
||
| 19 | DeclarativeBase = declarative_base(metadata=metadata) |
||
| 20 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.