Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79850

[ANN] dbf v0.96 is released

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'value,': 0.04; 'represents': 0.05; '(using': 0.07; 'attribute': 0.07; 'currency': 0.07; 'float': 0.07; 'memory.': 0.07; 'subject:ANN': 0.07; 'subject:released': 0.07; 'table.': 0.07; '===': 0.09; 'false,': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'implements': 0.09; 'message- id:@stoneleaf.us': 0.09; 'protocols.': 0.09; 'system;': 0.09; 'trailing': 0.09; 'python': 0.11; 'stored': 0.12; '(also': 0.16; '23,': 0.16; 'bool': 0.16; 'boolean': 0.16; 'finds': 0.16; 'logical,': 0.16; 'mapping,': 0.16; 'memo': 0.16; 'quantum': 0.16; 'retrieving': 0.16; 'sequence,': 0.16; 'statement.': 0.16; 'true),': 0.16; 'exception': 0.16; 'files.': 0.16; 'index': 0.16; 'appropriate': 0.16; 'module': 0.19; 'numerical': 0.19; 'value.': 0.19; '(the': 0.22; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'adds': 0.24; 'char': 0.24; 'integer': 0.24; 'logical': 0.24; 'unicode': 0.24; 'versions': 0.24; '(or': 0.24; 'tables': 0.26; '----------': 0.26; 'supported': 0.26; 'values': 0.27; 'record': 0.27; 'on,': 0.29; 'character': 0.29; 'raise': 0.29; 'newer': 0.30; 'returned': 0.30; "i'm": 0.30; 'datum': 0.31; 'etc.).': 0.31; 'reflected': 0.31; 'skip:= 40': 0.31; 'table,': 0.31; 'allows': 0.31; 'file': 0.32; 'entirely': 0.33; 'table': 0.34; 'skip:d 20': 0.34; 'common': 0.35; 'definition': 0.35; 'but': 0.35; 'combination': 0.36; 'disk': 0.36; 'returning': 0.36; 'sequence': 0.36; 'similar': 0.36; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'skip:- 10': 0.38; 'subject:[': 0.39; 'visual': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:u 10': 0.60; 'most': 0.60; 'received:173': 0.61; 'personal': 0.63; 'such': 0.63; 'field': 0.63; 'skip:n 10': 0.64; 'finally': 0.65; 'temporary': 0.65; 'qualified': 0.72; 'family': 0.73; 'other.': 0.75; 'age': 0.80; 'tour': 0.81; "'with'": 0.84; 'history,': 0.84; 'iii': 0.84; 'off,': 0.84; 'birth': 0.91; 'picture': 0.97
Date Tue, 28 Oct 2014 12:53:52 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version 1.0
To Python <python-list@python.org>
Subject [ANN] dbf v0.96 is released
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15265.1414526038.18130.python-list@python.org> (permalink)
Lines 134
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1414526038 news.xs4all.nl 2887 [2001:888:2000:d::a6]:33958
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79850

Show key headers only | View raw


and finally supports Python 3!  :)

Versions supported are 2.5 - 2.7, and 3.2+

=========================================

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/bytes (treated as binary)
         Picture   --> str/bytes (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
--------------

     import datetime
     import dbf

     table = dbf.Table(
             filename='test',
             field_specs='name C(25); age N(3,0); birth D; qualified L',
             on_disk=False,
             )
     table.open()

     for datum in (
             ('Spanky', 7, dbf.Date.fromymd('20010315'), False),
             ('Spunky', 23, dbf.Date(1989, 07, 23), True),
             ('Sparky', 99, dbf.Date(), dbf.Unknown),
             ):
         table.append(datum)

     for record in table:
         print record
         print '--------'
         print record[0:3]
         print record['name':'qualified']
         print [record.name, record.age, record.birth]
         print '--------'

     custom = table.new(
             filename='test_on_disk',
             default_data_types=dict(C=dbf.Char, D=dbf.Date, L=dbf.Logical),
             )

     with custom:    # automatically opened and closed
         for record in table:
             custom.append(record)
         for record in custom:
             dbf.write(record, name=record.name.upper())
             print record
             print '--------'
             print record[0:3]
             print record['name':'qualified']
             print [record.name, record.age, record.birth]
             print '--------'

     table.close()

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[ANN]  dbf v0.96 is released Ethan Furman <ethan@stoneleaf.us> - 2014-10-28 12:53 -0700
  Re: [ANN]  dbf v0.96 is released Cousin Stanley <cousinstanley@gmail.com> - 2014-10-28 13:34 -0700
    Re: [ANN]  dbf v0.96 is released Ethan Furman <ethan@stoneleaf.us> - 2014-10-28 13:51 -0700

csiph-web