gsheet_feeder_db
================

.. py:module:: gsheet_feeder_db


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/gsheet_feeder_db/gsheet_feeder_db/index
   /autoapi/gsheet_feeder_db/gworksheet/index




Package Contents
----------------

.. py:class:: GWorksheet(worksheet, columns=COLUMN_NAMES, header_row=1)

   This class makes read/write operations to the a worksheet easier.
   It can read the headers from a custom row number, but the row references
   should always include the offset of the header.
   eg: if header=4, row 5 will be the first with data.


   .. py:attribute:: COLUMN_NAMES


   .. py:attribute:: wks


   .. py:attribute:: columns


   .. py:attribute:: values


   .. py:method:: col_exists(col: str)


   .. py:method:: count_rows()


   .. py:method:: get_row(row: int)


   .. py:method:: get_values()


   .. py:method:: get_cell(row, col: str, fresh=False)

      returns the cell value from (row, col),
      where row can be an index (1-based) OR list of values
      as received from self.get_row(row)
      if fresh=True, the sheet is queried again for this cell



   .. py:method:: get_cell_or_default(row, col: str, default: str = None, fresh=False, when_empty_use_default=True)

      return self.get_cell or default value on error (eg: column is missing)



   .. py:method:: set_cell(row: int, col: str, val)


   .. py:method:: batch_set_cell(cell_updates)

      receives a list of [(row:int, col:str, val)] and batch updates it, the parameters are the same as in the self.set_cell() method



   .. py:method:: to_a1(row: int, col: str)


.. py:class:: GsheetsFeederDB

   Bases: :py:obj:`auto_archiver.core.Feeder`, :py:obj:`auto_archiver.core.Database`


   Base class for implementing feeders in the media archiving framework.

   Subclasses must implement the `__iter__` method to define platform-specific behavior.


   .. py:method:: setup() -> None


   .. py:method:: open_sheet() -> gspread.Spreadsheet


   .. py:method:: enumerate_sheets(sheet) -> Iterator[gspread.Worksheet]


   .. py:method:: should_process_sheet(sheet_name: str) -> bool


   .. py:method:: missing_required_columns(gw: auto_archiver.modules.gsheet_feeder_db.GWorksheet) -> list


   .. py:method:: started(item: auto_archiver.core.Metadata) -> None

      signals the DB that the given item archival has started



   .. py:method:: failed(item: auto_archiver.core.Metadata, reason: str) -> None

      update DB accordingly for failure



   .. py:method:: aborted(item: auto_archiver.core.Metadata) -> None

      abort notification if user cancelled after start



   .. py:method:: fetch(item: auto_archiver.core.Metadata) -> Union[auto_archiver.core.Metadata, bool]

      check if the given item has been archived already



   .. py:method:: done(item: auto_archiver.core.Metadata, cached: bool = False) -> None

      archival result ready - should be saved to DB



