Starting Work On Object Database In Python

15 Aug 2008 10:08

Good morning everyone,

today I start working on object database to be implemented in Python. This is my individual project for my classes.

During the study-year I was taught how to parse sophisticated grammar with PLY (Python Lex and Yacc library). I've then learned how to then process the parsed queries, to get the results.

The database query language is similar to the SQL language. The difference is, we don't have definitions of tables and fields. Any object (row in table) can have fields other that other objects with the same name (of the same table).

This seems quite hard, but it has its pros.

Moreover we've analyzed the following query using the simple parsing and processing:

SELECT employee.salary WHERE employee.salary > AVG(employee.salary);

now, having as much as 10000 employees, using the standard processing, this would mean calculating the average (AVG) from ALL salaries for EACH of the 10000 employees.

So the teacher proposed to use tree decoration, to mark the branches of the query syntax tree, that can be run once (i.e. their value does not depend on the rest of the query).

I proposed to do it other way: to don't analyze the tree to much, but instead implement a sort of caching. Each time we try to get the AVG(employee.salary) we check whether this was already calculated, if not (only the first time we get the AVG), we calculate this and populates the cache with the value.

This has the following pros:

  • we can use the cache in successive queries
  • we don't have to decorate query trees — it's not Christmas here

Today work I start with selecting a Python IDE to work with. During the classes I used PyDev — the Python plugin for Eclipse IDE, but I believe there any many new choices out there now — after a few months:

  • eric
  • pida
  • geany
  • drpython

(all from Ubuntu default repository)

More IDEs I found with Google:

Comments: 2

page 4 of 4« previous1234
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License