def get_mysqljoinTwo(): db = mysql_database() def db_query(): return db.joinTwo() res = db_query() return json_response(result=res)
def get_mysqlcount(): db = mysql_database() def db_query(): return db.count() res = db_query() return json_response(result=res)
def get_mysqldeleteMore(): db = mysql_database() def db_query(): return db.deleteMore() res = db_query() return json_response(result=res)
def get_mysqlupdateOne(): db = mysql_database() def db_query(): return db.updateOne() res = db_query() return json_response(result=res)
def get_mysqlfindAll(): db = mysql_database() def db_query(): return db.findAll() res = db_query() return json_response(result=res)
def insert_events(events): logging.info('Inserting events in database...') database = mysql_database() for event in events: if (event.description != None and event.source != None and event.date != None): insert_event_query = ('INSERT INTO events ' '(name, description, url, source, date) ' 'VALUES (%s, %s, %s, %s, %s)') database.query(insert_event_query, (event.name, event.description, event.url, event.source, event.date)) else: logging.warn( "Missing required event property, can't insert event in database: " + event.__str__()) database.cnx.commit()
def get_mysql_db(): return mysql_database(mysql_database_conf())
db=get_sqlite_db() print db db=get_mysql_db() print db db=get_pooled_mysql_db() print db db_conf=mysql_database_conf() pool_conf=database_pooling_conf() db1=mysql_database(db_conf) db=mysql_database(db_conf) for i in xrange(1): # if i%100==0: print i print db.conf print db.conn print db.addslashes('''a'b&p"m/ss''') print db.get_cursor() print db.conn print len(db.table('db')) print len(db.table_dict('db')) print db.one('select db from db') print db.first('select db from db') print db.one_dict('select db from db') print len(db.all('select * from db'))
def __init__(self): self.poloniex_conn = poloniex_functions() self.mysql_conn = mysql_database(self) self.ifttt_conn = ifttt()