dbf

pure python dbf reader/writer

https://github.com/ethanfurman/dbf

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

pure python dbf reader/writer

Basic Info
  • Host: GitHub
  • Owner: ethanfurman
  • Language: Python
  • Default Branch: master
  • Size: 5.47 MB
Statistics
  • Stars: 96
  • Watchers: 11
  • Forks: 39
  • Open Issues: 23
  • Releases: 0
Created about 6 years ago · Last pushed 10 months ago

https://github.com/ethanfurman/dbf/blob/master/

dbf
===

dbf (also known as python dbase) is a module for reading/writing
dBase III, FP, VFP, and Clipper .dbf database files.  It's
an ancient format that still finds lots of use (the most common
I'm aware of is retrieving legacy data so it can be stored in a
newer database system; other uses include GIS, stand-alone programs
such as Family History, Personal Finance, etc.).

Highlights
----------

Table -- represents a single .dbf/.dbt (or .fpt) file combination
and provides access to records; suports the sequence access and 'with'
protocols.  Temporary tables can also live entirely in memory.

Record -- repesents a single record/row in the table, with field access
returning native or custom data types; supports the sequence, mapping,
attribute access (with the field names as the attributes), and 'with'
protocols.  Updates to a record object are reflected on disk either
immediately (using gather() or write()), or at the end of a 'with'
statement.

Index -- nonpersistent index for a table.

Fields::

    dBase III (Null not supported)

        Character --> unicode
        Date      --> datetime.date or None
        Logical   --> bool or None
        Memo      --> unicode or None
        Numeric   --> int/float depending on field definition or None

        Float     --> same as numeric

    Clipper (Null not supported)

        Character --> unicode  (character fields can be up to 65,519)

    Foxpro (Null supported)

        General   --> str (treated as binary)
        Picture   --> str (treated as binary)

    Visual Foxpro (Null supported)

        Currency  --> decimal.Decimal
        douBle    --> float
        Integer   --> int
        dateTime  --> datetime.datetime

    If a field is uninitialized (Date, Logical, Numeric, Memo, General,
    Picture) then None is returned for the value.

Custom data types::

    Null     -->  used to support Null values

    Char     -->  unicode type that auto-trims trailing whitespace, and
                  ignores trailing whitespace for comparisons

    Date     -->  date object that allows for no date

    DateTime -->  datetime object that allows for no datetime

    Time     -->  time object that allows for no time

    Logical  -->  adds Unknown state to bool's: instead of True/False/None,
                  values are Truth, Falsth, and Unknown, with appropriate
                  tri-state logic; just as bool(None) is False, bool(Unknown)
                  is also False;  the numerical values of Falsth, Truth, and
                  Unknown is 0, 1, 2

    Quantum  -->  similar to Logical, but implements boolean algebra (I think).
                  Has states of Off, On, and Other.  Other has no boolean nor
                  numerical value, and attempts to use it as such will raise
                  an exception


Whirlwind Tour
--------------

Reading a DBF:

    import dbf
    
    dbf_filename = "some-file.dbf"
    encoding = "utf8"
    table = dbf.Table(dbf_filename, codepage=encoding, on_disk=True)
    field_names = table.field_names
    table.open()
    for record in table:
        row = {field_name: record[field_name] for field_name in field_names}
        print(row)  # You can use row.field_name to get each field's data also

Creating/writing a DBF:

    import datetime
    import dbf

    # create an in-memory table
    table = dbf.Table(
            filename='test',
            field_specs='name C(25); age N(3,0); birth D; qualified L',
            on_disk=False,
            )
    table.open(dbf.READ_WRITE)

    # add some records to it
    for datum in (
            ('Spanky', 7, dbf.Date.fromymd('20010315'), False),
            ('Spunky', 23, dbf.Date(1989, 7, 23), True),
            ('Sparky', 99, dbf.Date(), dbf.Unknown),
            ):
        table.append(datum)

    # iterate over the table, and print the records
    for record in table:
        print(record)
        print('--------')
        print(record[0:3])
        print([record.name, record.age, record.birth])
        print('--------')

    # make a copy of the test table (structure, not data)
    custom = table.new(
            filename='test_on_disk.dbf',
            default_data_types=dict(C=dbf.Char, D=dbf.Date, L=dbf.Logical),
            )

    # automatically opened and closed
    with custom:
        # copy records from test to custom
        for record in table:
            custom.append(record)
        # modify each record in custom (could have done this in prior step)
        for record in custom:
            dbf.write(record, name=record.name.upper())
            # and print the modified record
            print(record)
            print('--------')
            print(record[0:3])
            print([record.name, record.age, record.birth])
            print('--------')

    table.close()

Owner

  • Name: Ethan Furman
  • Login: ethanfurman
  • Kind: user

GitHub Events

Total
  • Issues event: 6
  • Watch event: 15
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 6
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 11
  • Fork event: 3
  • Create event: 2
Last Year
  • Issues event: 6
  • Watch event: 15
  • Delete event: 1
  • Issue comment event: 12
  • Push event: 6
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 11
  • Fork event: 3
  • Create event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 309
  • Total Committers: 10
  • Avg Commits per committer: 30.9
  • Development Distribution Score (DDS): 0.375
Past Year
  • Commits: 12
  • Committers: 2
  • Avg Commits per committer: 6.0
  • Development Distribution Score (DDS): 0.083
Top Committers
Name Email Commits
Ethan Furman e****n@s****s 193
Ethan Furman e****n@a****m 103
Lucas Taylor l****s@g****m 4
joshua.adelman j****n@g****m 2
Glenn Washburn d****t@e****m 2
Álvaro Justen a****n@g****m 1
Michael Howitz mh@g****m 1
Karthikeyan Singaravelan t****i@g****m 1
Cristián Pérez c****n@w****o 1
bfss b****s@b****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 41
  • Total pull requests: 22
  • Average time to close issues: 7 months
  • Average time to close pull requests: about 1 year
  • Total issue authors: 37
  • Total pull request authors: 14
  • Average comments per issue: 1.63
  • Average comments per pull request: 1.09
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 5
  • Pull requests: 8
  • Average time to close issues: about 3 hours
  • Average time to close pull requests: 15 days
  • Issue authors: 4
  • Pull request authors: 4
  • Average comments per issue: 0.6
  • Average comments per pull request: 0.25
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • apexbb (2)
  • cmsax (2)
  • turicas (2)
  • velle (2)
  • NicolasM-Forsk (1)
  • Takaketsu (1)
  • magiulianoUNICEF (1)
  • pwsandoval (1)
  • Cheevis (1)
  • joeribelis (1)
  • GirishKumarSharma (1)
  • goupeng2333 (1)
  • zexiangliu (1)
  • m0rgancz (1)
  • bmontana (1)
Pull Request Authors
  • velle (4)
  • wagnerpeer (3)
  • turicas (2)
  • cperezabo (2)
  • cmsax (2)
  • bfss (1)
  • paavoph (1)
  • reid-dev (1)
  • icemac (1)
  • nikimaxim (1)
  • dependabot[bot] (1)
  • munday-tech (1)
  • tirkarthi (1)
  • a-detiste (1)
Top Labels
Issue Labels
enhancement (3) bug (1)
Pull Request Labels
dependencies (1) python (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 46,791 last-month
  • Total docker downloads: 385
  • Total dependent packages: 2
    (may contain duplicates)
  • Total dependent repositories: 136
    (may contain duplicates)
  • Total versions: 102
  • Total maintainers: 1
pypi.org: dbf

Pure python package for reading/writing dBase, FoxPro, and Visual FoxPro .dbf files (including memos)

  • Versions: 71
  • Dependent Packages: 2
  • Dependent Repositories: 134
  • Downloads: 46,791 Last month
  • Docker Downloads: 385
Rankings
Downloads: 1.2%
Dependent repos count: 1.3%
Docker downloads count: 2.2%
Dependent packages count: 3.2%
Average: 3.9%
Forks count: 6.8%
Stargazers count: 8.5%
Maintainers (1)
Last synced: 10 months ago
conda-forge.org: dbf

Dbf is a pure Python package for reading/writing dBase, FoxPro, and Visual FoxPro .dbf files. Currently supports dBase III, Clipper, FoxPro, and Visual FoxPro tables. Text is returned as unicode, and codepage settings in tables are honored.

  • Versions: 18
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.4%
Forks count: 32.0%
Average: 36.9%
Stargazers count: 39.5%
Dependent packages count: 51.6%
Last synced: 10 months ago
anaconda.org: dbf

Dbf is a pure Python package for reading/writing dBase, FoxPro, and Visual FoxPro .dbf files. Currently supports dBase III, Clipper, FoxPro, and Visual FoxPro tables. Text is returned as unicode, and codepage settings in tables are honored.

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Forks count: 43.5%
Stargazers count: 47.4%
Average: 48.4%
Dependent packages count: 51.2%
Dependent repos count: 51.4%
Last synced: 10 months ago

Dependencies

setup.py pypi
  • aenum *