Let us search for entries containing 2 Ru atoms and 4 O atoms again. We know this should be the first entry from before. Note how much simpler this syntax is.
from ase.db import connect
# I want a sqlite extension, so we have to specify db as the type, which means sqlite
c = connect('vaspdb.sqlite', type='db')
for row in c.select('Ru=2,O=4'): print row
{'ctime': 14.236126003508412, 'energy': -44.251496, 'tags': array([0, 0, 0, 0, 0, 0], dtype=int32), 'positions': array([[ 1.3820537 , 1.3820537 , 0. ],
[ 3.14487964, 3.14487964, 0. ],
[ 3.64552037, 0.88141297, 1.54764608],
[ 0.88141297, 3.64552037, 1.54764608],
[ 0. , 0. , 0. ],
[ 2.26346667, 2.26346667, 1.54764608]]), 'calculator': u'vasp', 'calculator_parameters': {u'incar': {u'doc': u'INCAR parameters', u'prec': u'high', u'nbands': 43, u'sigma': 0.1, u'encut': 350.0}, u'doc': u'JSON representation of a VASP calculation.\n\nenergy is in eV\nforces are in eV/\\AA\nstress is in GPa (sxx, syy, szz, syz, sxz, sxy)\nmagnetic moments are in Bohr-magneton\nThe density of states is reported with E_f at 0 eV.\nVolume is reported in \\AA^3\nCoordinates and cell parameters are reported in \\AA\n\nIf atom-projected dos are included they are in the form:\n{ados:{energy:data, {atom index: {orbital : dos}}}\n', u'potcar': [[u'Ru', u'potpaw_PBE/Ru/POTCAR', u'dee616f2a1e7a5430bb588f1710bfea3001d54ea'], [u'O', u'potpaw_PBE/O/POTCAR', u'9a0489b46120b0cad515d935f44b5fbe3a3b1dfa']], u'input': {u'kpts': array([ 6, 6, 10]), u'reciprocal': False, u'xc': u'PBE', u'kpts_nintersections': None, u'setups': {}, u'txt': u'-', u'gamma': True}, u'atoms': {u'cell': array([[ 4.52693334, 0. , 0. ],
[ 0. , 4.52693334, 0. ],
[ 0. , 0. , 3.09529216]]), u'symbols': [u'O', u'O', u'O', u'O', u'Ru', u'Ru'], u'tags': array([0, 0, 0, 0, 0, 0]), u'pbc': array([ True, True, True], dtype=bool), u'positions': array([[ 1.3820537 , 1.3820537 , 0. ],
[ 3.14487964, 3.14487964, 0. ],
[ 3.64552037, 0.88141297, 1.54764608],
[ 0.88141297, 3.64552037, 1.54764608],
[ 0. , 0. , 0. ],
[ 2.26346667, 2.26346667, 1.54764608]])}, u'data': {u'stress': array([ 0.08843132, 0.08843132, 0.06042693, -0. , -0. , -0. ]), u'doc': u'Data from the output of the calculation', u'volume': 63.43221074143486, u'total_energy': -44.251496, u'forces': array([[-0.023609, -0.023609, 0. ],
[ 0.023609, 0.023609, 0. ],
[-0.023609, 0.023609, 0. ],
[ 0.023609, -0.023609, 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]), u'fermi_level': 5.0374}, u'metadata': {u'date.created': 1395241327.477995, u'uuid': u'7081ee4a-af77-11e3-a6e6-003048f5e49e', u'date.created.ascii': u'Wed Mar 19 11:02:07 2014', u'user.username': u'jkitchin', u'atoms.resort': array([2, 3, 4, 5, 0, 1]), u'user.email': u'jkitchin@andrew.cmu.edu', u'user.fullname': u'John Kitchin', u'O.potential.git_hash': u'9a0489b46120b0cad515d935f44b5fbe3a3b1dfa', u'atoms.tags': array([0, 0, 0, 0, 0, 0]), u'O.potential.path': u'potpaw_PBE/O/POTCAR', u'Ru.potential.path': u'potpaw_PBE/Ru/POTCAR', u'Ru.potential.git_hash': u'dee616f2a1e7a5430bb588f1710bfea3001d54ea'}}, 'cell': array([[ 4.52693334, 0. , 0. ],
[ 0. , 4.52693334, 0. ],
[ 0. , 0. , 3.09529216]]), 'numbers': array([ 8, 8, 8, 8, 44, 44], dtype=int32), 'forces': array([[-0.023609, -0.023609, 0. ],
[ 0.023609, 0.023609, 0. ],
[-0.023609, 0.023609, 0. ],
[ 0.023609, -0.023609, 0. ],
[ 0. , 0. , 0. ],
[ 0. , 0. , 0. ]]), 'mtime': 14.236126003508412, 'pbc': array([ True, True, True], dtype=bool), 'id': 1, 'unique_id': u'3ed58bb16897177be0ed56400c90b6f4', 'user': u'jkitchin'}