generator.explores.growth_accounting_explore

Growth Accounting explore type.

 1"""Growth Accounting explore type."""
 2
 3from __future__ import annotations
 4
 5from pathlib import Path
 6from typing import Any, Dict, Iterator, List, Optional
 7
 8from ..views import View
 9from . import Explore
10
11
12class GrowthAccountingExplore(Explore):
13    """A Growth Accounting Explore, from Baseline Clients Last Seen."""
14
15    type: str = "growth_accounting_explore"
16
17    def _to_lookml(self, v1_name: Optional[str]) -> List[Dict[str, Any]]:
18        """Generate LookML to represent this explore."""
19        return [
20            {
21                "name": self.name,
22                "view_name": self.views["base_view"],
23                "joins": self.get_unnested_fields_joins_lookml(),
24            }
25        ]
26
27    @staticmethod
28    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
29        """
30        If possible, generate a Growth Accounting explore for this namespace.
31
32        Growth accounting explores are only created for growth_accounting views.
33        """
34        for view in views:
35            if view.name == "growth_accounting":
36                yield GrowthAccountingExplore(
37                    view.name,
38                    {"base_view": "growth_accounting"},
39                )
40
41    @staticmethod
42    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
43        """Get an instance of this explore from a dictionary definition."""
44        return GrowthAccountingExplore(name, defn["views"], views_path)
class GrowthAccountingExplore(generator.explores.explore.Explore):
13class GrowthAccountingExplore(Explore):
14    """A Growth Accounting Explore, from Baseline Clients Last Seen."""
15
16    type: str = "growth_accounting_explore"
17
18    def _to_lookml(self, v1_name: Optional[str]) -> List[Dict[str, Any]]:
19        """Generate LookML to represent this explore."""
20        return [
21            {
22                "name": self.name,
23                "view_name": self.views["base_view"],
24                "joins": self.get_unnested_fields_joins_lookml(),
25            }
26        ]
27
28    @staticmethod
29    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
30        """
31        If possible, generate a Growth Accounting explore for this namespace.
32
33        Growth accounting explores are only created for growth_accounting views.
34        """
35        for view in views:
36            if view.name == "growth_accounting":
37                yield GrowthAccountingExplore(
38                    view.name,
39                    {"base_view": "growth_accounting"},
40                )
41
42    @staticmethod
43    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
44        """Get an instance of this explore from a dictionary definition."""
45        return GrowthAccountingExplore(name, defn["views"], views_path)

A Growth Accounting Explore, from Baseline Clients Last Seen.

type: str = 'growth_accounting_explore'
@staticmethod
def from_views( views: List[generator.views.view.View]) -> Iterator[GrowthAccountingExplore]:
28    @staticmethod
29    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
30        """
31        If possible, generate a Growth Accounting explore for this namespace.
32
33        Growth accounting explores are only created for growth_accounting views.
34        """
35        for view in views:
36            if view.name == "growth_accounting":
37                yield GrowthAccountingExplore(
38                    view.name,
39                    {"base_view": "growth_accounting"},
40                )

If possible, generate a Growth Accounting explore for this namespace.

Growth accounting explores are only created for growth_accounting views.

@staticmethod
def from_dict( name: str, defn: dict, views_path: pathlib.Path) -> GrowthAccountingExplore:
42    @staticmethod
43    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
44        """Get an instance of this explore from a dictionary definition."""
45        return GrowthAccountingExplore(name, defn["views"], views_path)

Get an instance of this explore from a dictionary definition.