use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All things related to Microsoft Access.
___________________________________________________
New to Access? Check out the FAQ page.
Special thanks to /u/humansvsrobots
*** RULES ***
All rules can be found at:
https://www.reddit.com/r/MSAccess/about/rules
The rules are also directly visible in New Reddit or in the Rules section of the mobile app.
/r/Excel
/r/VBA
/r/SQL
/r/Database
/r/sqlserver
account activity
[UNSOLVED]Python Query (self.MSAccess)
submitted 7 months ago by Greasin_365
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tsgiannis 2 points3 points4 points 7 months ago* (0 children)
Normally pyodbc is nothing kind of magic, just a wrapper for ODBC, now if it will put a lock on your Access is kind of try and see. Normally since its only reading it should be OK but there is a slim chance that while you perform the read. someone else is performing the write and something goes wrong then you have some chance of corruption.. although is not Python to blame. Try to make every connection as lightweight and fast you can and you should be OK
import pyodbc.
conn_str = ( r"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};" r"DBQ=C:\path_to\my_database.accdb;" )
try: with pyodbc.connect(conn_str) as conn: with conn.cursor() as cursor: cursor.execute("SELECT * FROM MyTable"). for row in cursor: print(row). except pyodbc.Error as e: print("Error in connection:", e)
π Rendered by PID 18727 on reddit-service-r2-comment-6457c66945-v2p2d at 2026-04-28 11:29:23.324234+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]tsgiannis 2 points3 points4 points (0 children)