Python Data base help

Brandon McCaig bamccaig at gmail.com
Mon Oct 17 13:46:42 EDT 2016


(Apologies for the old thread reviving)

On Sun, Oct 09, 2016 at 09:27:11PM +0200, Irmen de Jong wrote:
> What is your 'database'?
> >From the little information you provided it seems that it is just a text file where
> every drone measurement is on a line. So simply read every line and check if the time
> entered is in that line, then print it.

On the other hand, if your "database" really is just a text file
and you want to find the records that match a strict time string
there's already a fast native utility for this available: grep
(*nix) or findstr (Windows).

The advantage being that you could search for more than just the
time. It's still limited to only textual matches, not smart
matches (e.g., ranges). In the end, a custom program will be more
powerful to process the data.

Alternatively, if the data is a text file and you want to query
it regularly, consider learning a bit about SQL and sqlite3 and
import the data into a "real" database first. Then you'll get the
full expressive power of a query language and the performance
improvements of binary data and indexing (if you tune it right).

Regards,


-- 
Brandon McCaig <bamccaig at gmail.com> <bambams at castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bambams.ca/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'




More information about the Python-list mailing list