python - database field value that matches to every query -


i insert records sqlite database fields such every query specifies value field not disqualify record.

make model  engine parameter ford *      *          1 ford taurus *          2 ford escape *          3 

so query = (database.table.make == ford') & (database.table.model == 'taurus') return first 2 records

edit: woot, decided use following: (database.table.make.belongs('ford','')) & (database.table.model.belongs('taurus','')) syntax in operator in web2py

are looking this? won't perform due ors if have lot of rows.

select * cars ( cars.make = 'ford' or cars.make = '*' ) ,   ( cars.model = 'taurus' or cars.model = '*' ) 

here sql fiddle example.

if meant use null, can replace , replace or condition or cars.make null, etc.

or make maybe little less verbose:

select * cars cars.make in ('ford','*') ,   cars.model in ('taurus','*') 

but wouldn't able use null in case , have use * token.

sql fiddle


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -