• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

dbfread/H25-Nov-2016-1,369989

dbfread.egg-info/H03-May-2022-13184

docs/H25-Nov-2016-1,551971

examples/H25-Nov-2016-322227

testcases/H03-May-2022-

LICENSEH A D27-Nov-20141.1 KiB2318

MANIFEST.inH A D25-Apr-2015297 109

PKG-INFOH A D25-Nov-20164.1 KiB13184

README.rstH A D07-Jun-20163 KiB12175

run_tests.pyH A D27-Nov-2014507 2618

setup.cfgH A D25-Nov-2016144 149

setup.pyH A D25-Nov-2016894 4134

README.rst

1dbfread - Read DBF Files with Python
2====================================
3
4DBF is a file format used by databases such dBase, Visual FoxPro, and
5FoxBase+. This library reads DBF files and returns the data as native
6Python data types for further processing. It is primarily intended for
7batch jobs and one-off scripts.
8
9::
10
11    >>> from dbfread import DBF
12    >>> for record in DBF('people.dbf'):
13    ...     print(record)
14    OrderedDict([('NAME', 'Alice'), ('BIRTHDATE', datetime.date(1987, 3, 1))])
15    OrderedDict([('NAME', 'Bob'), ('BIRTHDATE', datetime.date(1980, 11, 12))])
16
17By default records are streamed directly from the file.  If you have
18enough memory you can instead load them into a list. This allows for
19random access::
20
21    >>> table = DBF('people.dbf', load=True)
22    >>> print(table.records[1]['NAME'])
23    Bob
24    >>> print(table.records[0]['NAME'])
25    Alice
26
27Full documentation at https://dbfread.readthedocs.io/
28
29See docs/changes.rst for a full list of changes in each version.
30
31
32Main Features
33-------------
34
35* written for Python 3, but also works in 2.7
36
37* simple but flexible API
38
39* data is returned as native Python data types
40
41* records are ordered dictionaries, but can be reconfigured to be of
42  any type
43
44* aims to handle all variants of DBF files. (Currently only widely
45  tested with Visual FoxPro, but should work well with other
46  variants.)
47
48* support for 18 field types. Custom types can be added by subclassing
49  ``FieldParser``
50
51* reads ``FPT`` and ``DBT`` memo files, both text and binary data
52
53* handles mixed case file names gracefully on case sensitive file systems
54
55* can retrieve deleted records
56
57
58Installing
59----------
60
61Requires Python 3.2 or 2.7.
62
63::
64
65  pip install dbfread
66
67``dbfread`` is a pure Python module and doesn't depend on any packages
68outside the standard library.
69
70To build documentation locally::
71
72    python setup.py docs
73
74This requires Sphinx. The resulting files can be found in
75``docs/_build/``.
76
77
78Source code
79------------
80
81Latest stable release: http://github.com/olemb/dbfread/
82
83Development version: http://github.com/olemb/dbfread/tree/develop/
84
85
86API Changes
87-----------
88
89``dbfread.open()`` and ``dbfread.read()`` are deprecated as of version
90``2.0``, and will be removed in ``2.2``.
91
92The ``DBF`` class is no longer a subclass of ``list``. This makes the
93API a lot cleaner and easier to understand, but old code that relied
94on this behaviour will be broken. Iteration and record counting works
95the same as before. Other list operations can be rewritten using the
96``record`` attribute. For example::
97
98    table = dbfread.read('people.dbf')
99    print(table[1])
100
101can be rewritten as::
102
103    table = DBF('people.dbf', load=True)
104    print(table.records[1])
105
106``open()`` and ``read()`` both return ``DeprecatedDBF``, which is a
107subclass of ``DBF`` and ``list`` and thus backward compatible.
108
109
110License
111-------
112
113dbfread is released under the terms of the `MIT license
114<http://en.wikipedia.org/wiki/MIT_License>`_.
115
116
117Contact
118-------
119
120Ole Martin Bjorndalen - ombdalen@gmail.com
121