Skip to content

idlesign/dbf_light

Repository files navigation

dbf_light

https://github.com/idlesign/dbf_light

LBC Python 2

release lic ci coverage

Description

Light and easy DBF reader

No fancy stuff, just DBF reading for most common format versions.

  • Python 2.7, 3.5+;
  • Uses namedtuple for row representation and iterative row reading to minimize memory usage;
  • Works fine with cyrillic (supports KLADR and CBRF databases);
  • Reads .dbf from zip files.

API

from dbf_light import Dbf


with Dbf.open('some.dbf') as dbf:

    for field in dbf.fields:
        print('Field: %s' % field)

    print('Rows (%s):' % dbf.prolog.records_count)

    for row in dbf:
        print(row)

# Read `some.dbf` from zip (ignoring filename case):
with Dbf.open_zip('some.dbf', 'here/myarch.zip', case_sensitive=False) as dbf:
    ...

CLI

Requires click package (can be installed with: pip install dbf_light[cli]).

$ dbf_light describe myfile.dbf
$ dbf_light show myfile.dbf