dbf.old

Package dbf :: Package old |
[hide private]

# Package old

source code

# Copyright

- Copyright: 2008-2009 Ad-Mail, Inc -- All rights reserved.
- Author: Ethan Furman
- Contact: ethanf@admailinc.com
- Organization: Ad-Mail, Inc.
- Version: 0.87.003 as of 03 Dec 2009

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Ad-Mail, Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Ad-Mail, Inc ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ad-Mail, Inc BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Summary

Python package for reading/writing dBase III and VFP 6 tables and memos

The entire table is read into memory, and all operations occur on the in-memory table, with data changes being written to disk as they occur.

Goals: programming style with databases

- `table = dbf.table('table name' [, fielddesc[, fielddesc[, ....]]])`
  - fielddesc examples: `name C(30); age N(3,0); wisdom M; marriage D`
- `record = [ table.current() | table[int] | table.append() | table.[next|prev|top|bottom|goto]() ]`
- `record.field | record['field']` accesses the field

NOTE: Of the VFP data types, auto-increment and null settings are not implemented.

Submodules | [hide private]
dbf.old._io: Routines for saving, retrieving, and creating fields dbf.old.dates: wrappers around datetime objects to allow null values dbf.old.exceptions: warnings and errors dbf.old.tables: table definitions

Functions | [hide private]
Table(filename, field_specs=`'````'`, memo_size=128, ignore_memos=False, read_only=False, keep_memos=False, meta_only=False, dbf_type=None, codepage=None) returns an open table of the correct dbf_type, or creates it if field_specs is given | source code
index(sequence) returns integers 0 - len(sequence) | source code
guess_table_type(filename) | source code
table_type(filename) returns text representation of a table's dbf version | source code
add_fields(table, field_specs) adds fields to an existing table | source code
delete_fields(table, field_names) deletes fields from an existing table | source code
export(table, filename=`'````'`, fields=`'````'`, format=`'``csv``'`, header=True) creates a csv or tab-delimited file from an existing table | source code
first_record(table) prints the first record of a table | source code
from_csv(csvfile, to_disk=False, filename=None, field_names=None, extra_fields=None, dbf_type=`'``db3``'`, memo_size=64, min_field_size=1) creates a Character table from a csv file to_disk will create a table with the same name filename will be used if provided field_names default to f0, f1, f2, etc, unless specified (list) extra_fields can be used to add additional fields -- should be normal field specifiers (list) | source code
get_fields(table) returns the list of field names of a table | source code
info(table) prints table info | source code
rename_field(table, oldfield, newfield) renames a field in a table | source code
structure(table, field=None) returns the definition of a field (or all fields) | source code
hex_dump(records) just what it says ;) | source code

Variables | [hide private]
| version = ``(`0`,` 88`,` 7`)``

Imports: os, csv, Date, DateTime, Time, DbfWarning, Bof, Eof, DbfError, DataOverflow, FieldMissing, DoNotIndex, DbfTable, Db3Table, VfpTable, FpTable, List, DbfCsv, sql, ascii, codepage, encoding, version_map