From 8de72ac10a7dc63dbdc6203692b39436545c278a Mon Sep 17 00:00:00 2001 From: Andy Lu Date: Sun, 21 Feb 2021 21:21:21 -0600 Subject: Get init to render --- docs/__init__.html | 225 ----------------------------------------------------- docs/index.html | 2 +- docs/init.html | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 226 insertions(+), 226 deletions(-) delete mode 100644 docs/__init__.html create mode 100644 docs/init.html diff --git a/docs/__init__.html b/docs/__init__.html deleted file mode 100644 index eb5d3b3..0000000 --- a/docs/__init__.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - __init__.py - - - -
-
-
-

__init__.py

-
-
-
-
-
- # -
-

This project syncs data from the v4 Google Sheets API.

-

Discovery Mode

-

There are a few static streams ("file_metadata", "spreadsheet_metadata", "sheet_metadata", -"sheets_loaded") and any number of dynamic streams. There’s one dynamic stream per sheet in the -one Google Sheets Doc.

-

Sync Mode

-
-
-
import sys
-import json
-import argparse # unused import
-import singer
-from singer import metadata, utils
-from tap_google_sheets.client import GoogleClient
-from tap_google_sheets.discover import discover
-from tap_google_sheets.sync import sync
-
-LOGGER = singer.get_logger()
-
-
-
-
-
-
- # -
-

Configuration

-
-
-
-
-
-
-
-
-
- # -
-

This is a typical OAuth2 tap. So in a config file we expect the following keys.

-
    -
  • -

    OAuth Related:

    -
      -
    • client_id
    • -
    • client_secret
    • -
    • refresh_token
    • -
    -
  • -
  • -

    Tap related:

    -
      -
    • spreadsheet_id
    • -
    • start_date
    • -
    • user_agent
    • -
    -
  • -
-
-
-
REQUIRED_CONFIG_KEYS = [
-    'client_id',
-    'client_secret',
-    'refresh_token',
-    'spreadsheet_id',
-    'start_date',
-    'user_agent'
-]
-
-
-
-
-
-
- # -
-

Discovery Mode

-
-
-
-
-
-
-
-
-
- # -
-

Creates a Singer Catalog and writes it to STDOUT

-
-
-
def do_discover(client, spreadsheet_id):
-
-
-
-
-
-
- # -
-

Inputs:

-
    -
  • client
  • -
  • An instance of the GoogleClient class
  • -
  • spreadsheet_id
  • -
  • The id of the Google Sheet
  • -
-

Returns:

-
    -
  • None
  • -
-

Side Effects:

-
    -
  • Writes to STDOUT
  • -
-
-
-
    LOGGER.info('Starting discover')
-    catalog = discover(client, spreadsheet_id)
-    json.dump(catalog.to_dict(), sys.stdout, indent=2)
-    LOGGER.info('Finished discover')
-
-
-
-
-
-
- # -
-

Entrypoint

-
-
-
-
-
-
-
-
-
- # -
-

Read a config, then run discovery mode or sync mode

-
-
-
@singer.utils.handle_top_exception(LOGGER)
-def main():
-
-
-
-
-
-
- # -
-

Inputs:

-
    -
  • None
  • -
-

Returns:

-
    -
  • None
  • -
-

Side Effects:

-
    -
  • Writes to STDOUT
  • -
-
-
-
    parsed_args = singer.utils.parse_args(REQUIRED_CONFIG_KEYS)
-
-    with GoogleClient(parsed_args.config['access_token'],
-                      parsed_args.config['user_agent']) as client:
-
-        state = {}
-        if parsed_args.state:
-            state = parsed_args.state
-
-        config = parsed_args.config
-        spreadsheet_id = config.get('spreadsheet_id')
-
-        if parsed_args.discover:
-            do_discover(client, spreadsheet_id)
-        elif parsed_args.catalog:
-            sync(client=client,
-                 config=config,
-                 catalog=parsed_args.catalog,
-                 state=state)
-
-
-
-
-
-
- # -
-

Unused

-
-
-
if __name__ == '__main__':
-    main()
-
-
-
-
-
-
- diff --git a/docs/index.html b/docs/index.html index 4b53e70..477d1c2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -17,7 +17,7 @@
#
-
  • __init__.html
  • +
  • __init__.html
  • client.html
  • discover.html
  • schema.html
  • diff --git a/docs/init.html b/docs/init.html new file mode 100644 index 0000000..eb5d3b3 --- /dev/null +++ b/docs/init.html @@ -0,0 +1,225 @@ + + + + + __init__.py + + + +
    +
    +
    +

    __init__.py

    +
    +
    +
    +
    +
    + # +
    +

    This project syncs data from the v4 Google Sheets API.

    +

    Discovery Mode

    +

    There are a few static streams ("file_metadata", "spreadsheet_metadata", "sheet_metadata", +"sheets_loaded") and any number of dynamic streams. There’s one dynamic stream per sheet in the +one Google Sheets Doc.

    +

    Sync Mode

    +
    +
    +
    import sys
    +import json
    +import argparse # unused import
    +import singer
    +from singer import metadata, utils
    +from tap_google_sheets.client import GoogleClient
    +from tap_google_sheets.discover import discover
    +from tap_google_sheets.sync import sync
    +
    +LOGGER = singer.get_logger()
    +
    +
    +
    +
    +
    +
    + # +
    +

    Configuration

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + # +
    +

    This is a typical OAuth2 tap. So in a config file we expect the following keys.

    +
      +
    • +

      OAuth Related:

      +
        +
      • client_id
      • +
      • client_secret
      • +
      • refresh_token
      • +
      +
    • +
    • +

      Tap related:

      +
        +
      • spreadsheet_id
      • +
      • start_date
      • +
      • user_agent
      • +
      +
    • +
    +
    +
    +
    REQUIRED_CONFIG_KEYS = [
    +    'client_id',
    +    'client_secret',
    +    'refresh_token',
    +    'spreadsheet_id',
    +    'start_date',
    +    'user_agent'
    +]
    +
    +
    +
    +
    +
    +
    + # +
    +

    Discovery Mode

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + # +
    +

    Creates a Singer Catalog and writes it to STDOUT

    +
    +
    +
    def do_discover(client, spreadsheet_id):
    +
    +
    +
    +
    +
    +
    + # +
    +

    Inputs:

    +
      +
    • client
    • +
    • An instance of the GoogleClient class
    • +
    • spreadsheet_id
    • +
    • The id of the Google Sheet
    • +
    +

    Returns:

    +
      +
    • None
    • +
    +

    Side Effects:

    +
      +
    • Writes to STDOUT
    • +
    +
    +
    +
        LOGGER.info('Starting discover')
    +    catalog = discover(client, spreadsheet_id)
    +    json.dump(catalog.to_dict(), sys.stdout, indent=2)
    +    LOGGER.info('Finished discover')
    +
    +
    +
    +
    +
    +
    + # +
    +

    Entrypoint

    +
    +
    +
    +
    +
    +
    +
    +
    +
    + # +
    +

    Read a config, then run discovery mode or sync mode

    +
    +
    +
    @singer.utils.handle_top_exception(LOGGER)
    +def main():
    +
    +
    +
    +
    +
    +
    + # +
    +

    Inputs:

    +
      +
    • None
    • +
    +

    Returns:

    +
      +
    • None
    • +
    +

    Side Effects:

    +
      +
    • Writes to STDOUT
    • +
    +
    +
    +
        parsed_args = singer.utils.parse_args(REQUIRED_CONFIG_KEYS)
    +
    +    with GoogleClient(parsed_args.config['access_token'],
    +                      parsed_args.config['user_agent']) as client:
    +
    +        state = {}
    +        if parsed_args.state:
    +            state = parsed_args.state
    +
    +        config = parsed_args.config
    +        spreadsheet_id = config.get('spreadsheet_id')
    +
    +        if parsed_args.discover:
    +            do_discover(client, spreadsheet_id)
    +        elif parsed_args.catalog:
    +            sync(client=client,
    +                 config=config,
    +                 catalog=parsed_args.catalog,
    +                 state=state)
    +
    +
    +
    +
    +
    +
    + # +
    +

    Unused

    +
    +
    +
    if __name__ == '__main__':
    +    main()
    +
    +
    +
    +
    +
    +
    + -- cgit v1.2.3