src/dirbs/utils.py
def is_table_partitioned(conn, tbl_name):
    """
    Function to determine whether a table is partitioned.

    Arguments:
        conn: DIRBS db connection object
        tbl_name: name of the table to check
    Returns:
        bool
    """
    with conn.cursor() as cursor:
        cursor.execute("""SELECT EXISTS (SELECT 1
                                           FROM pg_class
                                           JOIN pg_partitioned_table
                                                ON pg_partitioned_table.partrelid = pg_class.oid
                                          WHERE pg_class.relname = %s)""", [tbl_name])
        return cursor.fetchone().exists

    Function to determine whether a table is partitioned.

    Arguments:
        conn: DIRBS db connection object
        tbl_name: name of the table to check
    Returns:
        bool
    
Function to determine whether a table is partitioned.
Function to determine whether a table is partitioned .
def is_table_partitioned(conn, tbl_name):
    with conn.cursor() as cursor:
        cursor.execute("""SELECT EXISTS (SELECT 1
                                           FROM pg_class
                                           JOIN pg_partitioned_table
                                                ON pg_partitioned_table.partrelid = pg_class.oid
                                          WHERE pg_class.relname = %s)""", [tbl_name])
        return cursor.fetchone().exists
def is_table_partitioned ( conn , tbl_name ) : with conn . cursor ( ) as cursor : cursor . execute ( """SELECT EXISTS (SELECT 1
                                           FROM pg_class
                                           JOIN pg_partitioned_table
                                                ON pg_partitioned_table.partrelid = pg_class.oid
                                          WHERE pg_class.relname = %s)""" , [ tbl_name ] ) return cursor . fetchone ( ) . exists
Function to determine whether a table is partitioned.
Function to determine whether a table is partitioned .
"""
    Function to determine whether a table is partitioned.

    Arguments:
        conn: DIRBS db connection object
        tbl_name: name of the table to check
    Returns:
        bool
    """
None
conn
DIRBS db connection object
DIRBS db connection object
tbl_name
name of the table to check
name of the table to check