Which database system?

Michael Torrie torriem at gmail.com
Fri Sep 15 14:26:57 EDT 2017


On 09/15/2017 12:04 PM, Stefan Ram wrote:
>   When one is building an in-memory database that has a single
>   table that is built at the start of the program and then one
>   writes some complex queries to the table, what can be expected
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How do you plan to code these queries?  That really is what's going to
dictate the answer.  Basically with the first of your solutions below
you'll be manually creating the query code, doing all the selects,
projects, and joins manually (essentially an ad-hoc implementation of
relational algebra).  If you want to use SQL for composing such queries,
and not do the work yourself, then the second option is ideal.

In other languages like C#, there's the LINQ syntax which lets you
compose queries to a variety of data stores including things like lists.
 There is a project to bring LINQ-type queries to Python:
https://pypi.python.org/pypi/py-linq/0.4.0 .  that may work well with
your first option below.

>   to be faster:
> 
>     - implementing the table as a builtins.list of builtins.tuples
>       with builtins.dicts as indexes for faster lookups and
>       additional sorted builtins.lists for sorted "views" on the
>       table
> 
>     - implementing the table as a database table in sqlite3
>       (":memory:") and using SQL commands for insertion and
>       queries?
> 




More information about the Python-list mailing list