from sqlalchemy import DateTime, MetaData, Table, Column, text, Integer, String
from sqlalchemy.engine.reflection import Inspector
+from alembic.operations import Operations
+from sqlalchemy.sql import table, column
from alembic import command, util
from alembic.migration import MigrationContext
class PGOfflineEnumTest(TestCase):
@requires_07
def setUp(self):
- env = staging_env()
+ staging_env()
self.cfg = cfg = _no_sql_testing_config()
self.rid = rid = util.rev_id()
assert "DROP TABLE sometable" in buf.getvalue()
assert "DROP TYPE pgenum" in buf.getvalue()
-from alembic.migration import MigrationContext
-from alembic.operations import Operations
-from sqlalchemy.sql import table, column
class PostgresqlInlineLiteralTest(TestCase):
@classmethod
tab.update().where(
tab.c.col.like(self.op.inline_literal('%.%'))
).values(col=self.op.inline_literal('new data')),
- execution_options={'no_parameters':True}
+ execution_options={'no_parameters': True}
)
eq_(
self.conn.execute("select count(*) from tab where col='new data'").scalar(),
cls.bind = db_for_dialect("postgresql")
staging_env()
context = MigrationContext.configure(
- connection = cls.bind.connect(),
- opts = {
- 'compare_type':True,
- 'compare_server_default':True
+ connection=cls.bind.connect(),
+ opts={
+ 'compare_type': True,
+ 'compare_server_default': True
}
)
connection = context.bind
cls.autogen_context = {
- 'imports':set(),
- 'connection':connection,
- 'dialect':connection.dialect,
- 'context':context
+ 'imports': set(),
+ 'connection': connection,
+ 'dialect': connection.dialect,
+ 'context': context
}
@classmethod
def tearDown(self):
self.metadata.drop_all()
- def _compare_default_roundtrip(
- self, type_, txt, alternate=None):
+ def _compare_default_roundtrip(self, type_, txt, alternate=None):
if alternate:
expected = True
else:
"TIMEZONE('utc', CURRENT_TIMESTAMP)",
)
- def test_compare_current_timestamp(self):
- self._compare_default_roundtrip(
- DateTime(),
- "TIMEZONE('utc', CURRENT_TIMESTAMP)",
- )
-
def test_compare_integer(self):
self._compare_default_roundtrip(
Integer(),