title: How to use python statement as SELECT condition in SQLite?
body: <p>Normally, we can use only SQL statements as SELECT condition (using WHERE clause). However, it is sometimes useful to use python (or any language which evoke SQL) statement as SELECT condition.</p>
  
  <p>For example, there is a example <a href="http://docs.python.org/library/sqlite3.html#converting-sqlite-values-to-custom-python-types" rel="nofollow">in the document of sqlite3 module of python</a>, where a structure <code>Point</code> was stored into a table. However it is hard to query the table using the structure <code>Point</code>. Say, I want to do <code>SELECT p FROM table WHERE P.x=4</code> which select all the point with x coordinate equal to 4. But that <code>SELECT</code> statement won't work since <code>P.x</code> is a python statement rather than a SQL statement.</p>
  
  <p>Another example of this is that when the SELECT condition is too complex for SQL language. Say, I want to SELECT all integers which mod 4 is 3 or things like this.</p>
  
  <p>So, is there any idea of doing this? Thank you!</p>
  
  <p>EDIT: In respect of zam664's answer, it is surely possible for the first example to use P_X and P_Y. However, what if p is a list of an unknown length (which is able to be stored in a table using adapters) and I want to <code>SELECT p FROM table WHERE 2 in p</code>. I think this is a useful case.</p>