Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do I need to read Microsoft Access databases using Python?

How can I access Microsoft Access databases in Python? With SQL?

I'd prefere a solution that works with Linux, but I could also settle for Windows.

I only require read access.

like image 208
Georg Schölly Avatar asked May 12 '09 15:05

Georg Schölly


People also ask

How do you read an Access database in Python?

To access databases in Python, you'll need to use a database adapter. Python offers database adapters through its modules that allow access to major databases such as MySQL, PostgreSQL, SQL Server, and SQLite. Furthermore, all of these modules rely on Python's database API (DB-API) for managing databases.

What coding is used in Microsoft Access?

Access uses Visual Basic for Applications (VBA) as its development language.


1 Answers

On Linux, MDBTools is your only chance as of now. [disputed]

On Windows, you can deal with mdb files with pypyodbc.

To create an Access mdb file:

import pypyodbc pypyodbc.win_create_mdb( "D:\\Your_MDB_file_path.mdb" ) 

Here is an Hello World script that fully demostate pypyodbc's Access support functions.

Disclaimer: I'm the developer of pypyodbc.

like image 112
pypyodbc Avatar answered Sep 20 '22 14:09

pypyodbc