Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.04; 'versions,': 0.05; 'desired.': 0.07; 'read-only': 0.07; 'table.': 0.07; 'subject:question': 0.08; 'api': 0.09; 'sqlite': 0.09; 'surrounded': 0.09; 'url:github': 0.09; 'cc:addr:python-list': 0.10; 'aug': 0.13; 'resulting': 0.13; 'library': 0.15; 'file,': 0.15; 'colons': 0.16; 'disk.': 0.16; 'in-memory': 0.16; 'pythonic': 0.16; 'subject:API': 0.16; 'thoughts?': 0.16; 'wrote:': 0.17; 'expanded': 0.17; 'library,': 0.17; 'thu,': 0.17; 'memory': 0.18; 'earlier': 0.21; 'received:209.85.214.174': 0.21; 'cc:2**0': 0.23; "i've": 0.23; 'external': 0.24; 'feature': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'wondering': 0.26; 'first,': 0.27; 'converting': 0.27; 'disk': 0.27; 'library.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'record': 0.28; 'feature,': 0.29; 'in-house': 0.29; 'optional': 0.29; 'second,': 0.29; 'class': 0.29; "i'm": 0.29; 'file': 0.32; 'anyone': 0.33; 'agree': 0.34; 'received:google.com': 0.34; 'announcement': 0.35; 'pm,': 0.35; 'table': 0.35; 'received:209.85': 0.35; 'tool': 0.36; 'but': 0.36; 'method': 0.36; 'should': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'possible.': 0.38; 'instead': 0.39; 'received:209.85.214': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'decision': 0.60; 'save': 0.61; 'back': 0.62; 'situation': 0.62; 'provide': 0.62; 'more': 0.63; 'making': 0.64; 'decided': 0.65; 'results': 0.65; 'fact,': 0.69; 'furman': 0.84; 'url:master': 0.84; 'ethan': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JFwZOKGE0PCROQm49lkrqlkUQ1jlFec1U9F16eDF4PI=; b=iAtbugK7w4Cojb2d6EDhUYE7HbiGaJemDTf3H8yDhRQeCoYPpviFyFt1mN2Y9Kg6F3 4CxXKlSr7pcBDK4LZzToclC7sj8YmllEASBWGBpxoxkplHy8rLiIv1OBQXo54T1P6IiU puEz8Ki0ej4ph4g4hkdXQ92nHYtloGLtSYyiZ1zt7WUL9r3nCBO3P/dQ/TT3Onm1GTsO GTN8zbiGAC+2D9rv8zBPR6ZPOcbjb0twx23EJJ1kuW5NM/MmJFHdvQ4ZeAa8MH/HNyzT q2qAGn00uHR405L9I63SNd50Mh3TnmhDldDfzRMgOUAcJHooy/pUcT2cl2VPL1N49sa2 DIlQ== MIME-Version: 1.0 In-Reply-To: <501AA304.3090000@stoneleaf.us> References: <501AA304.3090000@stoneleaf.us> Date: Sun, 5 Aug 2012 05:04:36 +0200 Subject: Re: dbf.py API question From: =?UTF-8?Q?Ole_Martin_Bj=C3=B8rndalen?= To: Ethan Furman Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344135879 news.xs4all.nl 6850 [2001:888:2000:d::a6]:38005 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26521 On Thu, Aug 2, 2012 at 5:55 PM, 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. > > Thoughts? I agree that the flag would be more pythonic in dbf.py. I was not aware that you are adding sqlite functionality to your library. This is very cool! I have been through the same questions with my own DBF library, and I've come to some conclusions: First, I decided to make the library read-only and in-memory. That is all we need in-house anyway. Second, I decided to make an external tool for converting DBF files to sqlite: https://github.com/olemb/dbfget/blob/master/extras/dbf2sqlite (To anyone reading: I have not yet made a public announcement of dbfget, but I will shortly. Consider this an informal announcement: https://github.com/olemb/dbfget/ ) I am considering adding a "streaming=True" flag which would make the table class a record generator, and a "save()" method which would allow you to save data back to the file, or to a new file if you provide an optional file name. In fact, I had this functionality in earlier versions, but decided to chuck it out in order to make the API as clean as possible. I hope this can help you somehow in your decision making process.