Beispiel #1
0
def do_test_mysql():
    conn = boilerplate.get_mysql_connection()
    cur = conn.cursor()
    cur.execute(
        "SELECT table_name, column_name FROM INFORMATION_SCHEMA.COLUMNS")
    schema = dict()
    for table_name, column_name in cur.fetchall():
        schema.setdefault(table_name.decode('utf-8'), []).append(column_name)
    return {"schema": schema}
Beispiel #2
0
from hseling_api_cat_and_kittens import boilerplate
import sys
import re, string

CONN = boilerplate.get_mysql_connection()


def get_syntroles_dict():
    cur = CONN.cursor()
    cur.execute("SELECT * FROM syntroles;")
    syntrole_list = cur.fetchall()
    string2syntrole_id = {row[1]: row[0] for row in syntrole_list}
    return string2syntrole_id


def get_morph_dict():
    cur = CONN.cursor()
    cur.execute("SELECT * FROM pos;")
    morph_list = cur.fetchall()
    string2morph_id = {row[1]: row[0] for row in morph_list}
    return string2morph_id


def get_values(lemma1, lemma2, morph1, morph2, syntrole, min_, max_):

    string2syntrole_id = get_syntroles_dict()
    string2morph_id = get_morph_dict()

    if morph1 == None:
        morph1 = ""
    if morph2 == None: