从dbf文件中选择字段

问题描述 投票:1回答:2

我使用dbf 0.95.004,我需要从表格中选择一个字段。 Exampledocs

import dbf
table = dbf.Table('my.dbf').open()
records = table.sql('select name')

但是我有错误:

AttributeError: 'Db3Table' object has no attribute 'sql'

我打开dbf.py并找到

def pql(records, command):

不是def sql(records, command):中的docs

当然,我可以在没有sql的情况下这样做:

for record in table:
    record['name']

但是我需要使用sql-select。那么,如何解决呢?

python sql dbf
2个回答
2
投票
我的歉意(x2),文档已过时。您可以使用dbf.pql(table, 'blah blah')(之所以这样命名,因为它是一种非常类似于sql的语法),也可以使用table.query()。这些不是开发完善的例程,因为我发现使用常规Python语法更容易。

0
投票
[伊桑·弗曼(Ethan Furman),格拉西亚斯·波多尔·莫尔模(Gracias por el modulo),商业禁令,禁止营地]

Fields table

© www.soinside.com 2019 - 2024. All rights reserved.