什么可以从Python读取Microsoft .MDB文件? [英] Anything available that can read Microsoft .MDB files from Python?

查看:681
本文介绍了什么可以从Python读取Microsoft .MDB文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找可以读取.MDB文件的东西,这是Microsoft Access使用的格式

。我需要在

Linux上执行此操作,而不使用Microsoft工具。我只需要读一遍文件
,所以我可以将表加载到另一个数据库中。

速度不是问题,我不需要以

数据库方式访问该文件。文件太大,无法一次读入RAM,

虽然。


我试过MDBtools,但唯一的(最后一个)版本是

a三年前预发布,我遇到了很多构建问题试图让它在Fedora上运行

Core 6。


John Nagle

I''m looking for something that can read .MDB files, the format
Microsoft Access uses, from Python. I need to do this on
Linux, without using Microsoft tools. I just need to read
the files once, so I can load the tables into another database.
Speed isn''t an issue, and I don''t need to access the file in
database fashion. The files are too big to read into RAM all at once,
though.

I tried "MDBtools", but the only (last) release was
a pre-release three years ago, and I''ve encountered
many build problems trying to make it work on Fedora
Core 6.

John Nagle

推荐答案

John Nagle schrieb:
John Nagle schrieb:

我正在寻找可以读取.MDB文件的东西,这是Microsoft Access在Python中使用的格式

。我需要在

Linux上执行此操作,而不使用Microsoft工具。我只需要读一遍文件
,所以我可以将表加载到另一个数据库中。

速度不是问题,我不需要以

数据库方式访问该文件。文件太大,无法一次读入RAM,

虽然。


我试过MDBtools,但唯一的(最后一个)版本是

a三年前预发布,我遇到了很多构建问题试图让它在Fedora上运行

Core 6。
I''m looking for something that can read .MDB files, the format
Microsoft Access uses, from Python. I need to do this on
Linux, without using Microsoft tools. I just need to read
the files once, so I can load the tables into another database.
Speed isn''t an issue, and I don''t need to access the file in
database fashion. The files are too big to read into RAM all at once,
though.

I tried "MDBtools", but the only (last) release was
a pre-release three years ago, and I''ve encountered
many build problems trying to make it work on Fedora
Core 6.



我只是建议它。在ubuntu下,它很容易作为蛋糕,并且

很好地将mdb转换为一些CSV文件。


我认为你应该真的尝试让它工作。


Diez

I was just gonna suggest it. Under ubuntu, it works easy as cake, and
converts the mdb nicely to some CSV-files.

I think you should really try and make it work.

Diez


Diez B. Roggisch写道:
Diez B. Roggisch wrote:

John Nagle schrieb:
John Nagle schrieb:

>我正在寻找可以读取.MDB文件的东西,Microsoft Access使用的格式,来自Python。我需要在Linux上执行此操作,而不使用Microsoft工具。我只需要阅读一次文件,所以我可以将表加载到另一个数据库中。
速度不是问题,我不需要访问文件
数据库时尚。这些文件太大了,无法一次读入RAM。

我试过MDBtools,但唯一的(最后一个)版本是预先发布的
三年前,我遇到了许多构建问题,试图让它在Fedora上运行
Core 6.
> I''m looking for something that can read .MDB files, the format
Microsoft Access uses, from Python. I need to do this on
Linux, without using Microsoft tools. I just need to read
the files once, so I can load the tables into another database.
Speed isn''t an issue, and I don''t need to access the file in
database fashion. The files are too big to read into RAM all at once,
though.

I tried "MDBtools", but the only (last) release was
a pre-release three years ago, and I''ve encountered
many build problems trying to make it work on Fedora
Core 6.




我只是建议它。在ubuntu下,它很容易作为蛋糕,并且

很好地将mdb转换为一些CSV文件。


我认为你应该真的尝试让它工作。


Diez



I was just gonna suggest it. Under ubuntu, it works easy as cake, and
converts the mdb nicely to some CSV-files.

I think you should really try and make it work.

Diez



你安装了什么MDBtools? RPM,从CVS结账,

或可下载的发行版?他们都不一样。


John Nagle

What MDBtools did you install? The RPM, a checkout from CVS,
or the downloadable distribution? They''re all different.

John Nagle


3月19日下午2:45,John Nagle< n ... @ animats.comwrote:
On Mar 19, 2:45 pm, John Nagle <n...@animats.comwrote:

Diez B. Roggisch写道:
Diez B. Roggisch wrote:

John Nagle schrieb:
John Nagle schrieb:


我正在寻找可以读取.MDB文件的东西,格式

Microsoft Access使用Python。我需要在

Linux上执行此操作,而不使用Microsoft工具。我只需要读一遍文件
,所以我可以将表加载到另一个数据库中。

速度不是问题,我不需要以

数据库方式访问该文件。这些文件太大,无法一次读入RAM,但是,b $ b。
I''m looking for something that can read .MDB files, the format
Microsoft Access uses, from Python. I need to do this on
Linux, without using Microsoft tools. I just need to read
the files once, so I can load the tables into another database.
Speed isn''t an issue, and I don''t need to access the file in
database fashion. The files are too big to read into RAM all at once,
though.


我试过MDBtools,但唯一的(最后一个)版本是

a三年前预发布,我遇到了很多构建问题试图让它在Fedora上运行

Core 6.
I tried "MDBtools", but the only (last) release was
a pre-release three years ago, and I''ve encountered
many build problems trying to make it work on Fedora
Core 6.


我只是建议它。在ubuntu下,它很容易作为蛋糕,并且

很好地将mdb转换为一些CSV文件。
I was just gonna suggest it. Under ubuntu, it works easy as cake, and
converts the mdb nicely to some CSV-files.


我认为你应该尝试让它发挥作用。
I think you should really try and make it work.


Diez
Diez



你安装了什么MDBtools? RPM,从CVS结账,

或可下载的发行版?他们都不一样。


John Nagle


What MDBtools did you install? The RPM, a checkout from CVS,
or the downloadable distribution? They''re all different.

John Nagle



我已经使用ODBC读取.MDB文件。我不知道你的文件有多大,

但我有一个近3000行的文件,我能够在

1-2秒内获取它。如果你想让它旋转,你只需要创建一个

ODBC连接,然后执行以下操作:


myconn = odbc.odbc('' mydb_connection_name'')

mycursor = myconn.cursor()

mycursor.execute(''SELECT * FROM db_name'')

mydata = mycursor.fetchall()

mycursor.close()

myconn.close()

mydata中每个


#做一些事情,比如从变量mydata中提取信息。并且

将它发送到另一个数据库

它很快。但你可能会喜欢别人说的更多。


迈克

I''ve read .MDB files using ODBC. I don''t know how big your files are,
but I had a file with almost 3000 rows and I was able to fetch it in
1-2 seconds. If you want to give it whirl, you just need to create an
ODBC connection and then do the following:

myconn = odbc.odbc(''mydb_connection_name'')
mycursor = myconn.cursor()
mycursor.execute(''SELECT * FROM db_name'')
mydata = mycursor.fetchall()
mycursor.close()
myconn.close()

for each in mydata:
# do something like pull the info from the variable "mydata" and
send it into the other database
It is fast. But you may like what the others have said more.

Mike


这篇关于什么可以从Python读取Microsoft .MDB文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆