Skip to content

Commit

Permalink
Pin updated check deps and reformat (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline authored Oct 6, 2023
1 parent bda1a40 commit 2d9f76f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
7 changes: 4 additions & 3 deletions dbtmetabase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ class OptionAcceptableFromConfig(click.Option):
more resilence to raising an error when the option exists in the users config.
This also overrides default values for boolean CLI flags (e.g. --use_metabase_http/--use_metabase_https) in options when
no CLI flag is passed, but a value is provided in the config file (e.g. metabase_use_http: True)."""
no CLI flag is passed, but a value is provided in the config file (e.g. metabase_use_http: True).
"""

def process_value(self, ctx: click.Context, value: Any) -> Any:
if value is not None:
Expand Down Expand Up @@ -115,10 +116,10 @@ def process_value(self, ctx: click.Context, value: Any) -> Any:

class CommandController(click.Command):
"""This class inherets from click.Command and supplies custom help text renderer to
render our docstrings a little prettier as well as a hook in the invoke to load from a config file if it exists."""
render our docstrings a little prettier as well as a hook in the invoke to load from a config file if it exists.
"""

def invoke(self, ctx: click.Context):

if CONFIG:
for param, value in ctx.params.items():
if value is None and param in CONFIG:
Expand Down
6 changes: 0 additions & 6 deletions dbtmetabase/metabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,6 @@ def increase_indent(self, flow=False, indentless=False):
parsed_exposures = []

for collection in self.collections:

# Exclude collections by name
if collection["name"] in collection_excludes:
continue
Expand All @@ -657,7 +656,6 @@ def increase_indent(self, flow=False, indentless=False):
# Iter through collection
logger().info(":sparkles: Exploring collection %s", collection["name"])
for item in self.api("get", f"/api/collection/{collection['id']}/items"):

# Ensure collection item is of parsable type
exposure_type = item["model"]
exposure_id = item["id"]
Expand All @@ -678,7 +676,6 @@ def increase_indent(self, flow=False, indentless=False):

# Process exposure
if exposure_type == "card":

# Build header for card and extract models to self.models_exposed
header = "### Visualization: {}\n\n".format(
exposure.get("display", "Unknown").title()
Expand All @@ -689,7 +686,6 @@ def increase_indent(self, flow=False, indentless=False):
native_query = self.native_query

elif exposure_type == "dashboard":

# We expect this dict key in order to iter through questions
if "ordered_cards" not in exposure:
continue
Expand Down Expand Up @@ -824,7 +820,6 @@ def _extract_card_exposures(

# Find models exposed through joins
for query_join in query.get("query", {}).get("joins", []):

# Handle questions based on other question in virtual db
if str(query_join.get("source-table", "")).startswith("card__"):
self._extract_card_exposures(
Expand Down Expand Up @@ -853,7 +848,6 @@ def _extract_card_exposures(

# Parse SQL for exposures through FROM or JOIN clauses
for sql_ref in re.findall(self.exposure_parser, native_query):

# Grab just the table / model name
clean_exposure = sql_ref.split(".")[-1].strip('"').upper()

Expand Down
8 changes: 4 additions & 4 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
setuptools>=45
wheel
pylint
mypy
pylint>=2.13.9
mypy>=0.971
types-requests
types-PyYAML
black
restructuredtext-lint
black>=22.8.0
restructuredtext-lint>=1.4.0

0 comments on commit 2d9f76f

Please sign in to comment.