python 3.x – Multiple functions connected to SQL

I have created a thread before Previous code review and I have leanred quite alot and got back to situation where I feel like there should be a possiblity to eventually refactor the code even more. However I have followed the thread answer and improved my code. I hope there could be a way to even do it better since I love the improvements and the new knowledge!

Basically my goal is to have multiple functions etc if a link already exists, get all keywords and much more where I later on in other scripts can call those functions and get a return back

#!/usr/bin/python3
# -*- coding: utf-8 -*-
from datetime import datetime

import psycopg2
import psycopg2.extras

from config import configuration

DATABASE_CONNECTION = {
    "host": configuration.path.database.environment,
    "database": configuration.postgresql.database,
    "user": configuration.postgresql.user,
    "password": configuration.postgresql.password
}


class QuickConnection:
    def __init__(self):
        self.ps_connection = psycopg2.connect(**DATABASE_CONNECTION)
        self.ps_cursor = self.ps_connection.cursor(cursor_factory=psycopg2.extras.DictCursor)
        self.ps_connection.autocommit = True

    def __enter__(self):
        return self.ps_cursor

    """
    TODO - Print to discord when a error happens
    """

    def __exit__(self, err_type, err_value, traceback):
        if err_type and err_value:
            self.ps_connection.rollback()
        self.ps_cursor.close()
        self.ps_connection.close()
        return False


def link_exists(store, link):
    """
    Check if link exists
    :param store:
    :param link:
    :return:
    """

    dict_tuple = {"store": store, "link": link}

    sql_query = "SELECT EXISTS (SELECT DISTINCT link FROM public.store_items WHERE store=%(store)s AND link=%(link)s);"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return ps_cursor.fetchone()(0)


def register_products(store, product):
    """
    Register a product to database
    :param store:
    :param product:
    :return:
    """

    dict_tuple = {"store": store, "name": product("name"), "link": product("link"), "image": product("image"), "visible": "yes", "added_date": datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S.%f")}

    sql_query = "INSERT INTO public.store_items (store, name, link, image, visible, added_date) VALUES (%(store)s, %(name)s, %(link)s, %(image)s, %(visible)s, %(added_date)s);"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return bool(ps_cursor.rowcount)


def update_products(store, link):
    """
    Update products value
    :param store:
    :param link:
    :return:
    """

    dict_tuple = {"store": store, "link": link, "visible": "yes", "added_date": datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S.%f")}

    sql_query = "UPDATE public.store_items SET visible=%(visible)s, added_date=%(added_date)s WHERE store=%(store)s AND link=%(link)s;"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return bool(ps_cursor.rowcount)


def black_and_monitored_list(store, link):
    """
    Check if the link is already blacklisted or being monitored
    :param store:
    :param link:
    :return:
    """

    dict_tuple = {"type": "blacklist", "link": link, "store": store}

    sql_query = "SELECT EXISTS (SELECT store, link FROM manual_urls WHERE link=%(link)s AND store=%(store)s AND link_type=%(type)s) OR EXISTS (SELECT store, link FROM store_items WHERE link=%(link)s AND store=%(store)s);"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return ps_cursor.fetchone()(0)


def delete_manual_links(store, link):
    """
    Delete given link
    :param store:
    :param link:
    :return:
    """

    dict_tuple = {"store": store, "link": link}

    sql_query = "DELETE FROM public.manual_urls WHERE store=%(store)s AND link=%(link)s;"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return bool(ps_cursor.rowcount)


def get_product_data(store, link):
    """
    Get id from database for specific link
    :param store:
    :param link:
    :return:
    """

    dict_tuple = {"store": store, "link": link, "visible": "yes"}

    sql_query = "SELECT id, store, link FROM public.store_items WHERE store=%(store)s AND link=%(link)s AND visible=%(visible)s;"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        product = ps_cursor.fetchone()

        return {"id": product("id"), "store": product("store"), "link": product("link")}


def get_all_keywords(positive_or_negative):
    """
    Get all keywords
    :param positive_or_negative:
    :return:
    """

    dict_tuple = {"keyword": positive_or_negative}

    sql_query = "SELECT keyword FROM public.keywords WHERE filter_type = %(keyword)s;"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return (keyword("keyword") for keyword in ps_cursor)



def store_exists(store):
    """
    Check if the store exists in database
    :param store:
    :return:
    """

    dict_tuple = {"store": store}

    sql_query = "SELECT EXISTS (SELECT store FROM public.store_config WHERE store = %(store)s);"

    with QuickConnection() as ps_cursor:
        ps_cursor.execute(sql_query, dict_tuple)
        return ps_cursor.fetchone()(0)


def register_store(store):
    """
    Register the store
    :param store:
    :return:
    """
    if not store_exists(store=store):

        dict_tuple = {"store", store}

        sql_query = "INSERT INTO public.store_config (store) VALUES (%(store)s);"

        with QuickConnection() as ps_cursor:
            ps_cursor.execute(sql_query, dict_tuple)
            return bool(ps_cursor.rowcount)

    return False