Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.

Commit 1bec933

Browse files
Merge pull request #29 from jordiyeh/master
Add IDENTITY support when creating DDL
2 parents 516f12a + 40e543b commit 1bec933

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup
22

3-
version = '0.4.1'
3+
version = '0.4.2'
44
setup(
55
name='sqlalchemy-vertica-python',
66
version=version,

sqla_vertica_python/vertica_python.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
from sqlalchemy.dialects.postgresql.base import PGDialect
44
from sqlalchemy.dialects.postgresql import INTERVAL
55
from sqlalchemy.engine import reflection
6+
from sqlalchemy.schema import CreateColumn
7+
from sqlalchemy.ext.compiler import compiles
8+
9+
10+
# From Postgresql 10 IDENTITY columns section in sqlalchemy/dialects/postgresql/base.py
11+
@compiles(CreateColumn, 'vertica')
12+
def use_identity(element, compiler, **kw):
13+
text = compiler.visit_create_column(element, **kw)
14+
text = text.replace("SERIAL", "IDENTITY(1,1)")
15+
return text
16+
617

718
class VerticaDialect(PGDialect):
819
""" Vertica Dialect using a vertica-python connection and PGDialect """

0 commit comments

Comments
 (0)