backend.database#

Module Contents#

Classes#

DatabaseManager

Creates and manages a database connection to the SQLite database. This class is a singleton class.

class backend.database.DatabaseManager#

Creates and manages a database connection to the SQLite database. This class is a singleton class.

_instance#

The singleton instance of the class

conn: sqlite3.Connection#

Sqlite connection object

create_tables() None#

Called at the start of the application to create the required tables in the database.

get_user(userid: str) Tuple[str, str, str, str]#

Gets the Instagram user from the database with the given userid.

Parameters:

userid – The userid of the user to get

Returns:

The user with the given userid

add_user(userid: str, username: str, profile_pic_url: str, session: str) None#

Adds a new Instagram user to the database.

Parameters:
  • userid – The userid of the user to add

  • username – The username of the user to add

  • profile_pic_url – The profile picture url of the user to add

  • session – The Instaloader session data of the user converted into a json string

delete_user(userid: str) None#

Deletes an user from the database. Effectively logging them out of the application.

Parameters:

userid – The userid of the user to delete

get_users() List[Tuple[str, str, str, str]]#

Gets all the Instagram users from the database.

Returns:

A list of all the instagram users that are logged into the application