SqlAlchemy commit after using update() function without using a session
<p>My selections work but my updates and deletes do not.</p>

<pre><code>db_jb = create_engine(jb)
self.jobs = Table('Job', MetaData(jb), autoload=True)
# select - works
ss = select(self.jobs).where(
    self.jobs.c.job_guid == jobGuid
).limit(1)
rs = ss.execute()
rows = [r for r in rs]
rs.close()
# update - does not work
su = update(self.jobs, mysql_limit=1).where(
    self.jobs.c.job_guid == jobGuid
).values(jobStatus=status)
# does not have an affect
su.execution_options(autocommit=True)
rs = su.execute()
rs.close()
</code></pre>

<p>Prettify the <code>su</code> variable and the query is correct but its not being committed</p>

<pre><code>str(su.compile(dialect=None, compile_kwargs={'literal_binds': True}))
</code></pre>

<p>How do I commit my changes without using a Session?</p>

<p>Did you try to execute <code>COMMIT</code> as a raw statement, like</p>

<pre><code>db_jb.execute('COMMIT')
</code></pre>

<p>You could also put <code>db_jb.execute('BEGIN')</code> just before <code>ss = ...</code> to explicitly start a transaction</p>

python mysql session sqlalchemy commit