tests/catalog_api.py
def _populate_data_catalog_table(conn, filename, file_type, size, modified_time, is_valid_zip,
                                 is_valid_format, md5, extra_attributes=None, first_seen=None, last_seen=None):
    """Helper function to insert dummy data in to the data_catalog table."""
    if extra_attributes is None:
        extra_attributes = {}
    if first_seen is None:
        first_seen = datetime.now()
    if last_seen is None:
        last_seen = datetime.now()
    with conn.cursor() as cursor:
        cursor.execute("""INSERT INTO data_catalog(filename, file_type, compressed_size_bytes, modified_time,
                                      is_valid_zip, is_valid_format, md5, extra_attributes, first_seen, last_seen)
                               VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
                       [filename, file_type, size, modified_time, is_valid_zip,
                        is_valid_format, md5, json.dumps(extra_attributes), first_seen, last_seen])
        conn.commit()
Helper function to insert dummy data in to the data_catalog table.
Helper function to insert dummy data in to the data_catalog table.
Helper function to insert dummy data in to the data_catalog table .
def _populate_data_catalog_table(conn, filename, file_type, size, modified_time, is_valid_zip,
                                 is_valid_format, md5, extra_attributes=None, first_seen=None, last_seen=None):
    if extra_attributes is None:
        extra_attributes = {}
    if first_seen is None:
        first_seen = datetime.now()
    if last_seen is None:
        last_seen = datetime.now()
    with conn.cursor() as cursor:
        cursor.execute("""INSERT INTO data_catalog(filename, file_type, compressed_size_bytes, modified_time,
                                      is_valid_zip, is_valid_format, md5, extra_attributes, first_seen, last_seen)
                               VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
                       [filename, file_type, size, modified_time, is_valid_zip,
                        is_valid_format, md5, json.dumps(extra_attributes), first_seen, last_seen])
        conn.commit()
def _populate_data_catalog_table ( conn , filename , file_type , size , modified_time , is_valid_zip , is_valid_format , md5 , extra_attributes = None , first_seen = None , last_seen = None ) : if extra_attributes is None : extra_attributes = { } if first_seen is None : first_seen = datetime . now ( ) if last_seen is None : last_seen = datetime . now ( ) with conn . cursor ( ) as cursor : cursor . execute ( """INSERT INTO data_catalog(filename, file_type, compressed_size_bytes, modified_time,
                                      is_valid_zip, is_valid_format, md5, extra_attributes, first_seen, last_seen)
                               VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""" , [ filename , file_type , size , modified_time , is_valid_zip , is_valid_format , md5 , json . dumps ( extra_attributes ) , first_seen , last_seen ] ) conn . commit ( )
Helper function to insert dummy data in to the data_catalog table.
Helper function to insert dummy data in to the data_catalog table .
"""Helper function to insert dummy data in to the data_catalog table."""
conn
filename
file_type
size
modified_time
is_valid_zip
is_valid_format
md5
extra_attributes
first_seen
last_seen