Database

Description

class lab_utils.database.Database(config_file: str = None)[source]

Manages connections and operations with a PostgreSQL database. The class is based on the library psycopg2 and on this tutorial.

Methods

Database.__init__

Initializes the Database object.

Database.check_column

Checks if a column exists in a given table.

Database.check_table

Checks if a table exists.

Database.close

Closes the connection to the database.

Database.config

Loads the configuration.

Database.connect

Connects to the database.

Database.create_timescale_db

Creates a TimescaleDB table.

Database.new_column

Creates a new column in a given table.

Database.new_entry

Inserts data into a given table.