Undocumented
Class | TABLES |
Undocumented |
Method | __init__ |
Initializes a BaseRowDB instance (inherits from qA_ApDB). |
Method | add |
Adds a attribute to the database. If the attribute already exists, it returns True without adding it again. If the attribute does not exist, it appends the attribute to the attributes file and returns True. |
Method | attribute |
Checks if a attribute exists. |
Method | comment |
Checks if a note exists for a specified document by a specified note_title. |
Method | get |
Retrieves all documents data from the database. Each document is represented as a dictionary with "content" and "title" keys. |
Method | get |
Retrieves the attributes from the database. If the attributes file does not exist, it raises a FileNotFoundError. |
Method | get |
Retrieves the catalog. This method fetches the catalog from the database, which is stored in a JSON format. If the catalog does not exist, it raises a FileNotFoundError. |
Method | get |
Retrieves the content and icon of a specified document. |
Method | get |
Retrieves the base64-encoded images for a specified document from the POSTS_MEDIAS table. |
Method | get |
Retrieves the base64-encoded images for a specified note of a document from the COMMENTS_MEDIAS table. |
Method | get |
Retrieves notes for a specified document, with pagination support. If perpage is set to 0, all notes will be returned without pagination. If the pagination parameters are invalid, an empty list will be returned. |
Method | get |
Retrieves the vector store from the database. |
Method | post |
Checks if a document exists. |
Method | write |
Writes attributes to the database. If the attributes file already exists, it updates the content. If the attributes file does not exist, it creates a new file with the specified attributes. |
Method | write |
Writes the catalog to the database. If the catalog already exists, it updates the content. If the catalog does not exist, it creates a new file with the specified JSON content. |
Method | write |
Writes a note to a specified document. If the document does not exist, it raises a FileNotFoundError. If the note already exists, it raises a FileAlreadyExistsError. |
Method | write |
Writes a document to the database. If the document already exists, it raises a FileAlreadyExistsError. |
Method | write |
Writes the vector store to the database. |
Instance Variable | token |
Undocumented |
Method | _filter |
Constructs a filter dictionary for querying the BaseRow API. This method creates a filter that matches rows based on specified field-value pairs. |
Method | _get |
Makes a GET request to the BaseRow API to retrieve rows from a specified table. WARNNING: Only the fields listed in the include parameter can be used in the filters parameter. |
Method | _include |
Constructs an include string for querying the BaseRow API. |
Method | _post |
Makes a POST request to the BaseRow API to create a new row in a specified table. This method is not implemented and should be overridden in subclasses. |
Method | _update |
Makes a POST request to the BaseRow API to create a new row in a specified table. This method is not implemented and should be overridden in subclasses. |
Initializes a BaseRowDB instance (inherits from qA_ApDB). Args: token (str): The API token for authentication with the BaseRow API.
Adds a attribute to the database. If the attribute already exists, it returns True without adding it again. If the attribute does not exist, it appends the attribute to the attributes file and returns True. Args: attribute (str): The attribute to add. Returns: bool: True if the attribute was added successfully, False if it already exists. Raises: WriteInDatabaseError: If there is an error writing to the attributes file.
Checks if a attribute exists. Args: attribute (str): Name of the attribute to check. Returns: bool: True if the attribute exists, False otherwise. Raises: FileNotFoundError: If the attributes does not exist in the database.
Checks if a note exists for a specified document by a specified note_title. Args: post_title (str): Name of the document. note_title (str): Name of the note_title. Returns: bool: True if the note exists, False otherwise.
Retrieves all documents data from the database. Each document is represented as a dictionary with "content" and "title" keys. Returns: list[dict[str,str]]: A list of dictionaries containing the content and title of each document. Raises: FileNotFoundError: If no documents are found in the database.
Retrieves the attributes from the database. If the attributes file does not exist, it raises a FileNotFoundError. Returns: str: The attributes as a string, with each value on a new line. Raises: FileNotFoundError: If the attributes file is not found in the database.
Retrieves the catalog. This method fetches the catalog from the database, which is stored in a JSON format. If the catalog does not exist, it raises a FileNotFoundError. Returns: str: The catalog as a JSON string. Raises: FileNotFoundError: If the catalog is not found in the database.
Retrieves the content and icon of a specified document. Args: post_title (str): Name of the document to retrieve. Returns: tuple[str,str]: A tuple containing the document content and the icon in base64 format. Raises: FileNotFoundError: If the document does not exist in the database.
Retrieves the base64-encoded images for a specified document from the POSTS_MEDIAS table. Args: post_title (str): Name of the document. includes (list[str]): List of image file stems to include (e.g., ["screen1", "screen2"]). Returns: list[str]: A list of base64-encoded images for the document. Raises: FileNotFoundError: If the document does not exist.
str
, note_title: str
, includes: list[ str]
= []) -> list[ str]
:
¶
Retrieves the base64-encoded images for a specified note of a document from the COMMENTS_MEDIAS table. Args: post_title (str): Name of the document. note_title (str): Name of the note_title. includes (list[str]): List of image file stems to include. Returns: list[str]: A list of base64-encoded images for the note. Raises: FileNotFoundError: If the note does not exist.
str
, perpage: int
= 0, page: int
= 1) -> list[ tuple[ str, str, str]]
:
¶
Retrieves notes for a specified document, with pagination support. If perpage is set to 0, all notes will be returned without pagination. If the pagination parameters are invalid, an empty list will be returned. Args: post_title (str): Name of the document to retrieve notes for. perpage (int): Number of notes to return per page (0 for no pagination). page (int): Page number to retrieve (0-based index). Returns: list[str]: A list of notes for the specified document. Raises: FileNotFoundError: If the document does not exist or if no notes are found.
Retrieves the vector store from the database. Returns: bytes: The vector store data in bytes format. Raises: FileNotFoundError: If the vector store is not found in the database.
Checks if a document exists. Args: post_title (str): Name of the document to check. Returns: bool: True if the document exists, False otherwise.
Writes attributes to the database. If the attributes file already exists, it updates the content. If the attributes file does not exist, it creates a new file with the specified attributes. Args: attributes (str): The attributes to write, separated by new lines. Returns: bool: True if the write operation was successful. Raises: WriteInDatabaseError: If there is an error writing to the attributes file.
Writes the catalog to the database. If the catalog already exists, it updates the content. If the catalog does not exist, it creates a new file with the specified JSON content. Args: json (str): The JSON content to write to the catalog. Returns: bool: True if the write operation was successful. Raises: WriteInDatabaseError: If there is an error writing to the catalog file.
str
, note_title: str
, content: str
, medias: list[ tuple[ str, str]]
= []) -> bool
:
¶
Writes a note to a specified document. If the document does not exist, it raises a FileNotFoundError. If the note already exists, it raises a FileAlreadyExistsError. Args: post_title (str): Name of the document to note on. note_title (str): Name of the note_title. content (str): Content of the note. medias (list[str]): List of base64 encoded screenshots for the note. Returns: bool: True if the write operation was successful. Raises: FileNotFoundError: If the document does not exist. FileAlreadyExistsError: If the note already exists. WriteInDatabaseError: If there is an error writing to the database.
str
, content: str
, icon: str
= '', medias: list[ tuple[ str, str]]
= []) -> bool
:
¶
Writes a document to the database. If the document already exists, it raises a FileAlreadyExistsError. Args: post_title (str): Name of the document to write. icon (str): Base64 encoded icon for the document. media (list[str]): List of base64 encoded media for the document. content (str): Content of the document. Returns: bool: True if the write operation was successful. Raises: FileAlreadyExistsError: If the document already exists. WriteInDatabaseError: If there is an error writing to the database.
Writes the vector store to the database. Args: bytes_data (bytes): The vector store data in bytes format. Returns: bool: True if the write operation was successful. Raises: WriteInDatabaseError: If there is an error writing to the vector store.
list[ tuple[ str, str]]
, orfields: list[ tuple[ str, str]]
= []) -> str
:
¶
Constructs a filter dictionary for querying the BaseRow API. This method creates a filter that matches rows based on specified field-value pairs. Args: fields (list[tuple[str,str]]): A list of tuples where each tuple contains a field name and its corresponding value. Returns: dict[str, str]: A dictionary representing the filter.
TABLES
, include: list[ str]
= None, filters: list[ tuple[ str, str]]
= None, orfilters: list[ tuple[ str, str]]
= [], page: int
= None, size: int
= None) -> list[ dict]
:
¶
Makes a GET request to the BaseRow API to retrieve rows from a specified table. WARNNING: Only the fields listed in the include parameter can be used in the filters parameter. Args: table (TABLES): The table to query, specified as a TABLES enum. include (list[str], optional): A list of field names to include in the response. Defaults to None (all fields are used). filters (list[tuple[str,str]], optional): A list of tuples where each tuple contains a field name and its corresponding value for filtering. Defaults to None (no filter is applied). page (str, optional): The page number to retrieve. Defaults to 1. size (str, optional): The number of rows to retrieve per page. Defaults to 100. Returns: list[dict]: A list of dictionaries representing the rows that match the query.
Constructs an include string for querying the BaseRow API. Args: fields (list[str]): A list of field names to include in the query. Returns: str: A string representing the fields to include.
Makes a POST request to the BaseRow API to create a new row in a specified table. This method is not implemented and should be overridden in subclasses. Args: table (TABLES): The table to which the new row will be added. Returns: list[dict]: A list of dictionaries representing the newly created row(s). Raises: NotImplementedError: This method is not implemented.
Makes a POST request to the BaseRow API to create a new row in a specified table. This method is not implemented and should be overridden in subclasses. Args: table (TABLES): The table to which the new row will be added. Returns: list[dict]: A list of dictionaries representing the newly created row(s). Raises: NotImplementedError: This method is not implemented.