Skip to main content
`Ctrl`+`K`

# DataStoreSqlite

class DataStoreSqlite(*args, **kwargs)
  Attributes:
    completed
    db
    describe
    limit
    `locked`

      returns if lock_pid is NULL or doesn’t exist.

    `logs`

      returns all log records

    members
    `mode`

      string that references datastore mode, override in override in subclass constructor

    `not_completed`

      returns database records of type NotCompleted

    `record_type`

      class name of completed results

    `source`

      string that references connecting to data store, override in subclass constructor

    `summary_citations`

      Return a Table summarising stored citations.

    `summary_logs`

      returns a table summarising log files

    `summary_not_completed`

      returns a table summarising not completed results

  Methods

  `lock`() | if writable, and not locked, locks the database to this pid
  `md5`(unique_id) |
  `read`(unique_id) | identifier string formed from Path(table_name) / identifier
  `unlock`([force]) | remove a lock if pid matches.
  `write`(*, unique_id, data) | writes a completed record ending with .suffix
  `write_bib`(dest_path) | Write stored citations as a BibTeX .bib file.
  `write_citations`(*, data) | Write citations to the data store.
  `write_not_completed`(*, unique_id, data) | writes a not completed record as json

  close |
  drop_not_completed |
  validate |
  write_log |

  close() → None
  property completed: list[DataMemberABC]
  property db
  property describe: Table
  drop_not_completed(*, unique_id: str = '') → None
  property limit: int | None
  lock() → None

    if writable, and not locked, locks the database to this pid

  property locked: bool

    returns if lock_pid is NULL or doesn’t exist.

  property logs: list[DataMemberABC]

    returns all log records

  md5(unique_id: str) → str | None
    Parameters:
      unique_id

        name of data store member

      Returns
      ——-
      md5 checksum for the member, if available, None otherwise
  property members: list[DataMemberABC]
  property mode: Mode

    string that references datastore mode, override in override in subclass constructor

  property not_completed: list[DataMemberABC]

    returns database records of type NotCompleted

  read(unique_id: str) → str | bytes

    identifier string formed from Path(table_name) / identifier

  property record_type: str

    class name of completed results

  property source: str | Path

    string that references connecting to data store, override in subclass constructor

  store_suffix = 'sqlitedb'
  property summary_citations: TabularType

    Return a Table summarising stored citations.

  property summary_logs: TabularType

    returns a table summarising log files

  property summary_not_completed: Table

    returns a table summarising not completed results

  unlock(force=False) → None

    remove a lock if pid matches. If force, ignores pid. ignored if mode is READONLY

  validate() → TabularType
  write(*, unique_id: str, data: str | bytes) → DataMemberABC

    writes a completed record ending with .suffix

    Parameters:
      unique_id

        unique identifier

      data

        text data to be written

    Returns:
      a member for this record

    Notes

    Drops any not-completed member corresponding to this identifier

  write_bib(dest_path: str | Path) → None

    Write stored citations as a BibTeX .bib file.

  write_citations(*, data: tuple[CitationBase, ...]) → None

    Write citations to the data store. Subclasses should override.

  write_log(*, unique_id: str, data: str | bytes) → None
  write_not_completed(*, unique_id: str, data: str | bytes) → DataMemberABC

    writes a not completed record as json

    Parameters:
      unique_id

        unique identifier

      data

        text data to be written

    Returns:
      a member for this record