Skip to content

Commit

Permalink
Loads the dbt api spec from a file instead of Github
Browse files Browse the repository at this point in the history
  • Loading branch information
ekini committed Nov 14, 2024
1 parent 0e3fc2e commit 2108e14
Show file tree
Hide file tree
Showing 2 changed files with 1,939 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tap_dbt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@
import typing as t
from abc import abstractmethod
from functools import cache
from pathlib import Path

import requests
import yaml
from singer_sdk import RESTStream
from singer_sdk._singerlib import resolve_schema_references
from singer_sdk.authenticators import APIAuthenticatorBase, SimpleAuthenticator

OPENAPI_URL = (
"https://raw.githubusercontent.com/fishtown-analytics/dbt-cloud-openapi-spec"
"/ee64f573d79585f12d30eaafc223dc8a84052c9a/openapi-v2-old.yaml"
)


@cache
def load_openapi() -> dict[str, t.Any]:
Expand All @@ -25,8 +21,9 @@ def load_openapi() -> dict[str, t.Any]:
Returns:
The OpenAPI specification as a dict.
"""
response = requests.get(OPENAPI_URL, timeout=10)
return yaml.safe_load(response.text)
schema_path = Path(__file__).parent / "schemas" / "openapi_v2.yaml"
with Path.open(schema_path) as schema:
return yaml.safe_load(schema)


class DBTStream(RESTStream):
Expand Down
Loading

0 comments on commit 2108e14

Please sign in to comment.