libs/status.py
def create_table_schema(cls, topic, db):
        """
        Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
        The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.
        :param topic: The specific topic to be created for
        :param db: A PostgresSQL DB connection instance.
        """
        topic = topic.replace('.', '_')
        table_sql = f'''
        CREATE TABLE IF NOT EXISTS web_activity_{topic} (
        id SERIAL PRIMARY KEY,
        created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
        topic_offset BIGINT DEFAULT -1,
        test_from varchar(32) NOT NULL,
        url varchar(256) NOT NULL,
        event_time BIGINT,
        status response_status,
        phrase phrase_status,
        dns integer DEFAULT -1,
        response integer DEFAULT -1,
        detail varchar(128)
        );
        '''
        index_sql = f'''
        CREATE INDEX IF NOT EXISTS web_activity_url_index_{topic} ON web_activity_{topic} (url);
        '''
        with db.cursor() as curs:
            curs.execute(table_sql)
            curs.execute(index_sql)
        db.commit()

        Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
        The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.
        :param topic: The specific topic to be created for
        :param db: A PostgresSQL DB connection instance.
        
Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
The table name is in the format of web_activity_, which dots are replaced with underscores.
Given a DB connection create a corresponding PostgreSQL table for the specific topic . The table name is in the format of web_activity_ which dots are replaced with underscores .
def create_table_schema(cls, topic, db):
        topic = topic.replace('.', '_')
        table_sql = f'''
        CREATE TABLE IF NOT EXISTS web_activity_{topic} (
        id SERIAL PRIMARY KEY,
        created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
        topic_offset BIGINT DEFAULT -1,
        test_from varchar(32) NOT NULL,
        url varchar(256) NOT NULL,
        event_time BIGINT,
        status response_status,
        phrase phrase_status,
        dns integer DEFAULT -1,
        response integer DEFAULT -1,
        detail varchar(128)
        );
        '''
        index_sql = f'''
        CREATE INDEX IF NOT EXISTS web_activity_url_index_{topic} ON web_activity_{topic} (url);
        '''
        with db.cursor() as curs:
            curs.execute(table_sql)
            curs.execute(index_sql)
        db.commit()
def create_table_schema ( cls , topic , db ) : topic = topic . replace ( '.' , '_' ) table_sql = f'''
        CREATE TABLE IF NOT EXISTS web_activity_{topic} (
        id SERIAL PRIMARY KEY,
        created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
        topic_offset BIGINT DEFAULT -1,
        test_from varchar(32) NOT NULL,
        url varchar(256) NOT NULL,
        event_time BIGINT,
        status response_status,
        phrase phrase_status,
        dns integer DEFAULT -1,
        response integer DEFAULT -1,
        detail varchar(128)
        );
        ''' index_sql = f'''
        CREATE INDEX IF NOT EXISTS web_activity_url_index_{topic} ON web_activity_{topic} (url);
        ''' with db . cursor ( ) as curs : curs . execute ( table_sql ) curs . execute ( index_sql ) db . commit ( )
Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
Given a DB connection create a corresponding PostgreSQL table for the specific topic .
"""
        Given a DB connection, create a corresponding PostgreSQL table for the specific topic.
        The table name is in the format of web_activity_<topic>, which dots are replaced with underscores.
        :param topic: The specific topic to be created for
        :param db: A PostgresSQL DB connection instance.
        """
cls
topic
The specific topic to be created for
The specific topic to be created for
db
A PostgresSQL DB connection instance.
A PostgresSQL DB connection instance .