QLime Qwanturank

QLime is an experimental Python library that enables easy object oriented data access to data residing in various sources (most notably, relational databases). It includes an Object Relational Mapper.


Following is a brief list of features. For more features see the detailed feature list.


The latest version of QLime is 0.6.0. You can:

QLime is free to download and use based on a liberal BSD Style License.



You might also be interested in:

QwantUrank competition launched

It's been going since December 2! But we will write the 1st articles on the QwantUrank contest tomorrow! 😉2am is too late to try to write correctly…

December 2, purchase of domain names

Edit: Let's go this time! After registering two domain names yesterday specifically for the QwantUrank SEO competition , we will try to create the cleanest site possible. The pros of the SEO contests are launched and have means impossible to use here. So we are going to try different things and a little artisanal! The rules are simple , but that's also what risks launching an SEO package in borderline actions. We will see how the engine will react.

Objectives of the 1st weeks

Objective of the 1st week: create 2 Qwant Urank sites with the cleanest content possible. Then optimize each week to arrive at sites full of optimized content but as natural as possible. A priori therefore, no use of robots, automatically generated texts or network of sites to add links artificially. The only development planned if I have the courage and if the result is satisfactory: the real-time ranking of the qwanturank SEO competition . Easy for some technical SEO, it's a little challenge for me.

It is certain that I will be far in the results, but the final objective is to do the maximum! 6 months to get there!

After that ?

It is possible that I then decide to keep these domain names to create content specific to Qwant and to the specific SEO techniques of this search tool. I am rather convinced that the rules are similar to Google, but in what proportions? I am in a hurry to have access to a Qwant Search Console, to manage this type of site but especially for other sites that I manage like Passionhockey.com which I would like to optimize thoroughly for Qwant. For the moment, this is not the case and I would like to know why!


These examples just scratch the surface of what QLime is capable of. See also the detailed feature list.

Single Table
For a database table users:

username firstname lastname

Here is sample code that prints filtered records:

from qlime import pgsql, DataObject

class User(DataObject):


connection = pgsql.DSConn(dbname='dbname', username='user', password='pass')
obclass = connection['public.users'] # public.users is the tablename


for u in User.find(lastname='Smith'):

print u.username, u.firstname
Joined Tables
For a database table users:

username firstname lastname

and a table groups:

username groupname

Here is sample code that joins the two tables and loads data in qwanturank

from qlime import pgsql, DataObject

class User(DataObject):


class Group(DataObject):


connection = pgsql.DSConn(dbname='dbname', username='user', password='pass')

# Create a new composite obclass called 'users' based on existing obclass
# 'public.users'. Composite obclasses can contain non-atomic attributes based
# on joins.

users = connection.new_composite_obclass('users', 'public.users')
groups = connection['public.groups']

# Create a new attribute 'groups' based on existing obclass
# called 'public.groups', by joining this object's 'username' attribute
# with that object's 'username' attribute.

users.join_obclass(subobname='groups', join_attr='username',

jointo_oc='public.groups', jointo_attr='username')


for u in User.find(lastname='Smith'):

print u.username, u.firstname
for g in u.groups:
print g.groupname
Here is a query that filters on a joined table column:

Ready to try? Download QLime and read the handbook.

Version 0.6.0

Relased Nov 6, 2005.

This is the first release after re-branding and cleaning up of the QLime library.


qwanturank seo qwant


How to Install

Download compressed file to temporary folder. Extract compressed file. Change to newly created QLime-0.6.0 directory and run:

python setup.py install

Feedback and Support

Use the mailing list for all feedback and questions: http://groups.google.com/group/qlime.

The QLime Handbook 0.6.0

Copyright (c) 2005, Shalabh Chaturvedi. All Rights Reserved.

$Id: qlime_handbook.html 18 2005-11-06 18:49:58Z shalabh $


1 Supported Platforms
2 Downloading and Installing
3 Simple Data Access
4 Relational Data Access
Data Types
Search and Filters
Advanced Features
5 Resources

This handbook describes installation and use of the QLime Data Access Layer. Send comments about this document to shalabh at cafepy.com.

1 Supported Platforms

QLime is written entirely in Python 2.3 and should run wherever Python can run.


Mac OS X
Data Sources:

PostgreSQL (requires PyPgSQL)
Firebird (requires KInterbasDB)
CSV files

2 Downloading and Installing

QLime requires Python version 2.3 or greater.


To use PostgreSQL, install pyPgSQL.
To use Firebird, install KInterbasDB.

Read the license agreement
If you accept the agreement, download either the tar.gz or the zip compressed file: http://www.qlime.org/0.6.0/QLime-0.6.0.tar.gz (for all platforms). http://www.qlime.org/0.6.0/QLime-0.6.0.zip (for all platforms).


Uncompress the downloaded file:

tar xzf QLime-0.6.0.tar.gz
(or unzip if using Qlime-0.6.0.tar.gz)

Cd to the created directory:

cd QLime-0.6.0
Run setup.py:

python setup.py install
QLime should now be installed in the Python site-packages directory (for example, /usr/local/lib/python2.3/site-packages/qlime/). To see if it is installed correctly, run python and do:

>>> import qlime
It should not return any errors.

3 Simple Data Access

Data access from scratch consists of the following steps:

Write a data object class.
Create a data source connection.
Find/construct a source objectclass from the connection.
Tie the data object class to the source objectclass.
Sounds fancy, but it's really quite simple. Here are all 4 steps:

# This is tutorial/phonedata.py

from qlime import DataObject
from qlime import csvdb

# Data class

class Phone(DataObject):


# Connection

conn = csvdb.DSConn(filepath="phone.csv", attrs=['name', 'number'])

# Source objectclass - a csv based datasource has only one objectclass

obclass = conn['default']

# Bind the data class to the objectclass

That's it! Now our class is ready to use:

# Creating and saving

p = Phone()
p.name = 'spam'
p.number = '333-4444'

p = Phone()
p.name = 'eggs'
p.number = '777-0000'


# Reading it back

p = Phone.find_one(name='eggs')
print p.number

# Updating

p.number = '999-1111'

Remember that the data class is a Python class you define and the source objectclass is an instance returned by the connection object.

4 Relational Data Access

Ensure you have setup the PostgreSQL database and have installed the pyPgSQL module. You should be familiar with creating databases and tables. Login to a database of your choice and create a table called 'phone' with two columns:

CREATE TABLE phone (name VARCHAR(10), number VARCHAR(10));
Insert some data into the table:

INSERT INTO phone (name, number) VALUES ('spam', '222-2222');
INSERT INTO phone (name, number) VALUES ('eggs', '555-5555');
INSERT INTO phone (name, number) VALUES ('bacon', '800-bacon');
Here's a new sample file that gets data from the database:

# This is tutorial/phonedata2.py

from qlime import DataObject, pgsql

conn = pgsql.DSConn(dbname='dbname', username='user', password='pass')
obclass = conn['public.phone']

class Phone(DataObject):



p = Phone.find_one(name='spam')
print p.number
Replace 'dbname', 'user' and 'pass' above with appropriate values.

The PostgreSQL connection returns each table as an objectclass with the fully qualified name (schema.tablename) as the name of the objectclass. The default schema in PostgreSQL is called 'public' hence we use the 'public.' prefix.

If using Firebird, follow the exact same steps except:

Ensure the KInterbasDB module is installed.
Use qlime.firebird.DSConn instead of qlime.pgsql.DSConn in phonedata2.py.
Do not prefix the tablename with 'public.'.
Data Types
QLime does not introduce its own data types. It simply passes through the data types of the underlying database library (for e.g. PyPgSQL or KInterbasDB).

QLime supports transactions via two methods on the connection object:


CSV files are not fully transactional.

Search and Filters
There are three ways to search a DataObject:

find(**kw) # returns iterator

find_one(**kw) # returns object or None

search(filter) # returns iterator
To construct a filter, use class level attributes - some examples:


from qlime import Or
Phone.search(Or(Phone.name.isEq('eggs'), Phone.number.isEq('555-3333')))
The search() method also supports limit and sort_on keyword arguments:

Phone.search(limit=5, sort_on=(Phone.name, Phone.number))
This will sort first by name and then by number.

Let's assume we have another users table:

CREATE TABLE users (username VARCHAR(10), fullname VARCHAR(100));
Here is a join between this table and the earlier phone table:

# This is tutorial/userphone.py

from qlime import pgsql, DataObject

class Phone(DataObject):


class User(DataObject):


conn = pgsql.DSConn(dbname='dbname', username='user', password='pass')
phone = conn['public.phone']
user = conn.new_composite_obclass('User', 'public.users')

user.join_obclass('phones', join_attr='username', jointo_oc='public.phone',



for u in User.find():

print u.fullname
for p in u.phones:
print p.number
You need a composite objectclass to do joins. The method new_composite_obclass(name, primary_obclass) specifies:

name: name of the new composite objectclass created
primary_obclass: existing objectclass on which the new objectclass is based
The join method join_obclass(subobname, join_attr, jointo_oc, jointo_attr) specifies:

subobname - name of the new attribute that will be added the composite objectclass
join_attr - existing attribute of the composite objectclass to use for join
jointo_oc, jointo_attr - the target objectclass and attribute to use for join
Once joined, the subobname attribute of the main class will pull out instances of the jointo_oc class.

You can build joins on top of other composite objectclasses.

Advanced Features
Multi-valued and single-valued joins: Use the keyword parameter is_multi in the join_obclass() method.

Lazy attributes: Use the set_lazy_attributes() method on the source objectclass.

Cyclic joins and self joins: Use the usual join_obclass() method.

Filtering on sub-objects qwant qwanturank seo : Use attribute notation to filter even on sub-object attributes! For example:

Optimizations For non-lazy joins, QLime is optimized to fire the minimal number of SQL queries. For example, when loading a user row, all the joined objets are loaded in the same query.


qwanturank qwant seo referencement concours classement qwant.com


qwanturank qwant seo referencement concours classement qwant.com

classement qwanturank

qwanturank qwant seo referencement concours classement qwant.com