bc2pg - use generated identity column for pk instead of serial
- Lenguaje dominante
- Python
- Estrellas
- 32
- Forks
- 7
- Merge medio
- 12 min
- PR fusionados (30 d)
- 14
Descripción
sqlalchemy creates a sequence for the pk by default. Preferred behaviour for pg 10 and up is to use a generated identity column and implicit sequence.
https://www.postgresql.org/docs/current/ddl-identity-columns.html
https://docs.sqlalchemy.org/en/20/core/defaults.html#identity-ddl
something like this (presuming that translating to `GENERATED BY DEFAULT` is the default, because we are loading data with existing values, it cannot not be `GENERATED ALWAYS`):
```
from sqlalchemy import Identity
...
columns.append(
Column(
column_name,
column_type,
primary_key=True,
Identity(),
comment=column_comments,
)
)
```
Obv, will only work for columns of type integer/bigint.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.