2 Comments
User's avatar
Ricardo Enrique Tay's avatar

Hi Jonathon, thanks again for the post.

Just wanted to note in case someone else experiences the same issue, that when I was trying to query the users table using SQLAlchemy package, it wasn't returning anything, but it also wan't throwing any errors. I had trouble with this for a while and went through my script line by line, commented lines out, used repr and keys methods to confirm the table existed.

I even created a SQLAlchemy table from a sqlite file I found on Datacamp and finally the select script worked.

This confirmed the issue was with the insert even though that also wasn't returning any error messages.

It turns out, after applying echo=True in the create_engine call, that the insert statement was being rolledback. So similar to what you've described in the PYODBC section, you also have to use the commit method in SQLAlchemy to push the insert.

Finally I can move on :)

Expand full comment
Jonathon Kindred's avatar

Hi Ricardo, you're completely correct. You do need to commit changes even within SQLAlchemy. Apologies, I'd missed that line of code but I've updated it now.

Thanks for pointing that out. Hope you've been enjoying the series so far!

Expand full comment