Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import sqlite3
import cherrypy
import json
class ExposeRealStateDB(object):
app = '/tmp/propertyRS.db'
def getproperty(self, id):
return json.dumps(str(self.getPropertyId(id)))
#return 'Property is'
def getPropertyId(self, post_id):
db = self.connect_db()
sql = 'select, price, typeprop, contract, location, state, description, image.path from property inner join image on = image.property_id where' + post_id
print sql
cur = db.execute(sql)
propertyRecords = [dict(id=row[0], price=row[1], type=row[2], contract=row[3] , location=row[4], state=row[5], description=row[6], imagetodisplay=row[7]) for row in cur.fetchall()]
print propertyRecords
return propertyRecords
def connect_db(self):
return sqlite3.connect(
if __name__=='__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment