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


Groups > comp.lang.python > #26434

Re: dbf.py API question

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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; '(so': 0.07; 'correspond': 0.07; 'desired.': 0.07; 'omit': 0.07; 'table.': 0.07; 'subject:question': 0.08; '(although': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'objects.': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'sql,': 0.09; 'sqlite': 0.09; 'surrounded': 0.09; '~ethan~': 0.09; 'resulting': 0.13; "hasn't": 0.15; 'colons': 0.16; 'creation.': 0.16; 'disk.': 0.16; 'flag,': 0.16; 'in-memory': 0.16; 'pythonic': 0.16; 's/he': 0.16; 'subject:API': 0.16; 'thoughts?': 0.16; 'wrote:': 0.17; 'certainly': 0.17; 'expanded': 0.17; 'memory': 0.18; 'do.': 0.21; 'back.': 0.22; "i'd": 0.22; 'tables': 0.23; 'seems': 0.23; 'random': 0.24; 'feature': 0.24; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'wondering': 0.26; 'disk': 0.27; 'thoughts': 0.27; 'initial': 0.28; 'feature,': 0.29; 'table,': 0.29; 'convert': 0.29; "i'm": 0.29; 'connection': 0.30; 'feedback': 0.30; 'point': 0.31; 'could': 0.32; 'interface,': 0.33; 'to:addr:python-list': 0.33; 'operations': 0.33; 'skip:d 20': 0.34; 'that,': 0.34; 'table': 0.35; 'really': 0.36; 'but': 0.36; 'method': 0.36; 'anything': 0.36; "i'll": 0.36; 'should': 0.36; 'thank': 0.36; 'does': 0.37; 'quite': 0.37; 'rather': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'perform': 0.38; 'object': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'decision': 0.60; 'you.': 0.61; 'situation': 0.62; 'results': 0.65; 'received:67.18': 0.65; 'directly.': 0.78; 'low': 0.83; 'beside': 0.84; 'flag.': 0.84; 'furman': 0.84; "it'd": 0.84; 'otten': 0.84; 'received:67.18.82': 0.84; 'received:67.18.82.12': 0.84; 'dealt': 0.91; 'ethan': 0.91
Date Fri, 03 Aug 2012 06:11:59 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version 1.0
To python-list@python.org
Subject Re: dbf.py API question
References <501AA304.3090000@stoneleaf.us> <jvg43b$j3c$1@dough.gmane.org>
In-Reply-To <jvg43b$j3c$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([192.168.74.2]) [50.137.155.36]:4082
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 1
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2902.1344000089.4697.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1344000089 news.xs4all.nl 6867 [2001:888:2000:d::a6]:59321
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26434

Show key headers only | View raw


Peter Otten wrote:
> Ethan Furman wrote:
> 
>> SQLite has a neat feature where if you give it a the file-name of
>> ':memory:' the resulting table is in memory and not on disk.  I thought
>> it was a cool feature, but expanded it slightly: any name surrounded by
>> colons results in an in-memory table.
>>
>> I'm looking at the same type of situation with indices, but now I'm
>> wondering if the :name: method is not pythonic and I should use a flag
>> (in_memory=True) when memory storage instead of disk storage is desired.
>  
> For SQLite it seems OK because you make the decision once per database. For 
> dbase it'd be once per table, so I would prefer the flag.

So far all feedback is for the flag, so that's what I'll do.


> Random
> 
>> Thoughts?
> 
> - Do you really want your users to work with multiple dbf files? I think I'd 
> rather convert to SQLite, perform the desired operations using sql, then 
> convert back.

Seems like that would be quite a slow-down (although if a user wants to 
do that, s/he certainly could).

> - Are names required to manipulate the table? If not you could just omit 
> them to make the table "in-memory".

At one point I had thought to make tables singletons (so only one copy 
of /user/bob/scores.dbf) but that hasn't happened and is rather low 
priority, so at this point the name is not required for anything beside 
initial object creation.

> - How about a connection object that may either correspond to a directory or 
> RAM:
> 
> db = dbf.connect(":memory:")
> table = db.Table("foo", ...)

dbf.py does not support the DB-API interface, so no connection objects. 
   Tables are opened directly and dealt with directly.

All interesting thoughts that made me think.  Thank you.

~Ethan~

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


Thread

Re: dbf.py API question Ethan Furman <ethan@stoneleaf.us> - 2012-08-03 06:11 -0700

csiph-web