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        explore_lookml = {
20            "name": self.name,
21            "view_name": self.views["base_view"],
22            "joins": self.get_unnested_fields_joins_lookml(),
23        }
24
25        if datagroup := self.get_datagroup():
26            explore_lookml["persist_with"] = datagroup
27
28        return [explore_lookml]
29
30    @staticmethod
31    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
32        """
33        If possible, generate a Growth Accounting explore for this namespace.
34
35        Growth accounting explores are only created for growth_accounting views.
36        """
37        for view in views:
38            if view.name == "growth_accounting":
39                yield GrowthAccountingExplore(
40                    view.name,
41                    {"base_view": "growth_accounting"},
42                )
43
44    @staticmethod
45    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
46        """Get an instance of this explore from a dictionary definition."""
47        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        explore_lookml = {
21            "name": self.name,
22            "view_name": self.views["base_view"],
23            "joins": self.get_unnested_fields_joins_lookml(),
24        }
25
26        if datagroup := self.get_datagroup():
27            explore_lookml["persist_with"] = datagroup
28
29        return [explore_lookml]
30
31    @staticmethod
32    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
33        """
34        If possible, generate a Growth Accounting explore for this namespace.
35
36        Growth accounting explores are only created for growth_accounting views.
37        """
38        for view in views:
39            if view.name == "growth_accounting":
40                yield GrowthAccountingExplore(
41                    view.name,
42                    {"base_view": "growth_accounting"},
43                )
44
45    @staticmethod
46    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
47        """Get an instance of this explore from a dictionary definition."""
48        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]:
31    @staticmethod
32    def from_views(views: List[View]) -> Iterator[GrowthAccountingExplore]:
33        """
34        If possible, generate a Growth Accounting explore for this namespace.
35
36        Growth accounting explores are only created for growth_accounting views.
37        """
38        for view in views:
39            if view.name == "growth_accounting":
40                yield GrowthAccountingExplore(
41                    view.name,
42                    {"base_view": "growth_accounting"},
43                )

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:
45    @staticmethod
46    def from_dict(name: str, defn: dict, views_path: Path) -> GrowthAccountingExplore:
47        """Get an instance of this explore from a dictionary definition."""
48        return GrowthAccountingExplore(name, defn["views"], views_path)

Get an instance of this explore from a dictionary definition.