I'm using alembic and sqlalchemy to work with different database types. I use an own create_sequence-methode and the drop_sequence-method of Operations from alembic. Now I'm making unittests to test my functionality. I want to alter/interrogate the sequence that I created before. But how?
def create_sequence(self, sequence):
kwargs_list = sequence
self.oprt.execute(CreateSequence(sequence))
def drop_sequence(self, sequence_name):
self.oprt.drop_sequence(sequence_name)
self.oprt is initialized like this:
engine = create_engine(connection_string, echo=True) # echo=True to get executed sql
conn = engine.connect()
ctx = MigrationContext.configure(connection=conn)
self.oprt = Operations(ctx)
I tried already to get a Sequence object with the help of the engine-object or an Metadata-Object. It doesn't work yet