def get_latest_feed_json(c, feed_url): return get_value(c, '''select rr.data from rss_result rr, feed_result_last frl where frl.feed_result_id = rr.feed_result_id and rr.result_url = ? ''', (feed_url, ))
def main(): databases = DatabasesZeroMqClient('localhost', 9090) with databases.connect('test') as conn: with conn.cursor() as cursor: assert 1 == get_value(cursor, '''select 1''') test_connection(cursor)
def main(): databases = RemoteDatabasesClient(remote_connections(connections)) with databases.connect('test') as conn: with conn.cursor() as cursor: result = get_value(cursor, '''select 1''') assert 1 == result test_connection(cursor)
def main(): client = HttpServerRequests(('localhost', 8086)) databases = DatabaseHttpClient(client) with databases.connect('test') as conn: with conn.cursor() as cursor: assert 1 == get_value(cursor, '''select 1''') test_connection(cursor)
def main(): #Start server in servers/queue databases = RemoteDatabasesClient(queue_client(server_address=('127.0.0.1', 50000))) with databases.connect('test') as conn: with conn.cursor() as cursor: result = get_value(cursor, '''select 1''') assert 1 == result test_connection(cursor)
def main(): pool = pool_manager_process(connections) connection = pool.connect('test') with closing(connection) as conn: cursor = conn.cursor() with closing(cursor) as cursor: assert 1 == get_value(cursor, '''select 1''') test_connection(cursor)
def main(): pool = pool_client(server_address=('127.0.0.1', 50001)) connection = pool.connect('test') with closing(connection) as conn: cursor = conn.cursor() with closing(cursor) as cursor: assert 1 == get_value(cursor, '''select 1''') test_connection(cursor)
def get_feed_entry_id(c, feed_id, url): return get_value( c, '''select id from feed_entry where feed_id = ? and url = ? ''', (feed_id, url))
def get_feed_id(cursor, url): return get_value(cursor, '''select id from feed where url = ? ''', (url, ))
def get_feed_result_entry_id(c, feed_result_id, feed_entry_id): return get_value(c, '''select id from feed_result_entry where feed_result_id = ? and feed_entry_id = ?''', (feed_result_id, feed_entry_id))
def get_feed_result_id(c, result_id, published): return get_value(c, '''select id from feed_result where result_id = ? and published = ?''', (result_id, published))
def get_feed_result_location_id(c, feed_id, result_url): return get_value(c, '''select id from feed_result_location where feed_id = ? and url = ? ''', (feed_id, result_url))
def get_feed_entry_id(c, feed_id, url): return get_value(c, '''select id from feed_entry where feed_id = ? and url = ? ''', (feed_id, url))