Example #1
0
def query_categories_ids(categories):
    db = PostgresConn()
    res = db.filter(filter_field="categoria",
                    filter_values=categories,
                    fields=["id", "categoria"],
                    schema="noticias",
                    table="categorias")
    db.close()
    return res
Example #2
0
def query_page_id(page):
    db = PostgresConn()
    res = db.filter(filter_field="nome",
                    filter_values=[page],
                    fields=["id", "nome"],
                    schema="noticias",
                    table="paginas")
    db.close()
    return res[0][0]
Example #3
0
def map_users_ids(users):
    db = PostgresConn()
    users_ids = db.filter("name", users, ["id", "name"], "reddit", "users")
    db.close()
    return {name: _id for _id, name in users_ids}
Example #4
0
def query_all_users(users):
    db = PostgresConn()
    _ids = db.filter("reddit_id", users, ["id", "reddit_id"], "reddit",
                     "users")
    db.close()
    return _ids