예제 #1
0
파일: tags.py 프로젝트: hatnote/hashtags
def get_all_tags():
    connection = ht_db_connect()
    cursor = connection.cursor()
    query = '''
    SELECT ht_text, ht_update_timestamp
    FROM hashtags'''
    cursor.execute(query)
    return cursor.fetchall()
예제 #2
0
def get_all_tags():
    connection = ht_db_connect()
    cursor = connection.cursor()
    query = '''
    SELECT ht_text, ht_update_timestamp
    FROM hashtags'''
    cursor.execute(query)
    return cursor.fetchall()
예제 #3
0
파일: tags.py 프로젝트: hatnote/hashtags
def get_tagged_changes(tag):
    connection = ht_db_connect()
    cursor = connection.cursor(oursql.DictCursor)
    query = '''
    SELECT *
    FROM recentchanges AS rc
    JOIN hashtag_recentchanges AS htrc
      ON htrc.htrc_id = rc.htrc_id
    JOIN hashtags AS ht
      ON ht.ht_id = htrc.ht_id
    WHERE ht.ht_text = ?'''
    params = (tag,)
    cursor.execute(query, params)
    return cursor.fetchall()
예제 #4
0
def get_tagged_changes(tag):
    connection = ht_db_connect()
    cursor = connection.cursor(oursql.DictCursor)
    query = '''
    SELECT *
    FROM recentchanges AS rc
    JOIN hashtag_recentchanges AS htrc
      ON htrc.htrc_id = rc.htrc_id
    JOIN hashtags AS ht
      ON ht.ht_id = htrc.ht_id
    WHERE ht.ht_text = ?'''
    params = (tag, )
    cursor.execute(query, params)
    return cursor.fetchall()
예제 #5
0
파일: update.py 프로젝트: intracer/hashtags
 def add_complete_record(self, lang, output=None, run_uuid=None):
     output = output or ''
     if len(output) > 1024:
         output = output[:4096]
     if not run_uuid:
         run_uuid = RUN_UUID
     params = (lang, output, run_uuid)
     conn = ht_db_connect()
     try:
         with conn.cursor() as cursor:
             cursor.execute('INSERT INTO complete_log'
                            ' (lang, output, run_uuid)'
                            ' VALUES (?, ?, ?)', params)
     finally:
         conn.close()
     return
예제 #6
0
파일: update.py 프로젝트: intracer/hashtags
 def add_start_record(self, lang, command=None, run_uuid=None):
     if not command:
         command = get_command_str()
     if len(command) > 1024:
         command = command[:1024]
     if not run_uuid:
         run_uuid = RUN_UUID
     params = (lang, command, run_uuid)
     conn = ht_db_connect()
     try:
         with conn.cursor() as cursor:
             cursor.execute('INSERT INTO start_log'
                            ' (lang, command, run_uuid)'
                            ' VALUES (?, ?, ?)', params)
     finally:
         conn.close()
     return
예제 #7
0
 def connect(self):
     self.wiki_connect = wiki_db_connect(self.lang, db_host='analytics')
     self.ht_connect = ht_db_connect()
예제 #8
0
파일: update.py 프로젝트: intracer/hashtags
 def connect(self):
     wiki_db_name = self.lang + 'wiki_p'
     wiki_db_host = self.lang + 'wiki.labsdb'
     self.wiki_connect = db_connect(wiki_db_name, wiki_db_host)
     self.ht_connect = ht_db_connect()