src/dirbs/schema_migrators/v84_upgrade.py
def _define_unique_bitcount_func(self, logger, conn):
        """Helper method to define unique_bitcount sql function."""
        logger.debug('Defining unique_bitcount() function...')
        with conn.cursor() as cursor:
            cursor.execute(sql.SQL("""CREATE FUNCTION unique_bitcount(n INTEGER) RETURNS INTEGER
                                          LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE
                                          AS $$
                                          BEGIN
                                              IF (SELECT bitcount(n)) > 0
                                              THEN
                                                  RETURN 1;
                                              ELSE
                                                  RETURN 0;
                                              END IF;
                                          END;
                                    $$;
                                    """))
        logger.debug('unique_bitcount() function definition successful')
Helper method to define unique_bitcount sql function.
Helper method to define unique_bitcount sql function.
Helper method to define unique_bitcount sql function .
def _define_unique_bitcount_func(self, logger, conn):
        logger.debug('Defining unique_bitcount() function...')
        with conn.cursor() as cursor:
            cursor.execute(sql.SQL("""CREATE FUNCTION unique_bitcount(n INTEGER) RETURNS INTEGER
                                          LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE
                                          AS $$
                                          BEGIN
                                              IF (SELECT bitcount(n)) > 0
                                              THEN
                                                  RETURN 1;
                                              ELSE
                                                  RETURN 0;
                                              END IF;
                                          END;
                                    $$;
                                    """))
        logger.debug('unique_bitcount() function definition successful')
def _define_unique_bitcount_func ( self , logger , conn ) : logger . debug ( 'Defining unique_bitcount() function...' ) with conn . cursor ( ) as cursor : cursor . execute ( sql . SQL ( """CREATE FUNCTION unique_bitcount(n INTEGER) RETURNS INTEGER
                                          LANGUAGE plpgsql IMMUTABLE PARALLEL SAFE
                                          AS $$
                                          BEGIN
                                              IF (SELECT bitcount(n)) > 0
                                              THEN
                                                  RETURN 1;
                                              ELSE
                                                  RETURN 0;
                                              END IF;
                                          END;
                                    $$;
                                    """ ) ) logger . debug ( 'unique_bitcount() function definition successful' )
Helper method to define unique_bitcount sql function.
Helper method to define unique_bitcount sql function .
"""Helper method to define unique_bitcount sql function."""
self
logger
conn