Question

I use dbf 0.95.004, I need to select one field from table. Example, docs

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

But I have error:

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

I open dbf.py and find

def pql(records, command):

Not def sql(records, command): like in the docs.

Ofcourse, I can do like this without sql:

for record in table:
    record['name']

But I need to use sql-select. So, how to fix it?

Was it helpful?

Solution

My apologies (x2), the docs are way out of date. You can either use dbf.pql(table, 'blah blah') (named that way because it is a very limited sql-like syntax), or table.query(). These are not well developed routines as I found using normal Python syntax easier.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top