generator.explores.ping_explore

Ping explore type.

 1"""Ping explore type."""
 2
 3from __future__ import annotations
 4
 5from pathlib import Path
 6from typing import Any, Dict, Iterator, List, Optional
 7
 8from ..views import PingView, View
 9from . import Explore
10
11
12class PingExplore(Explore):
13    """A Ping Table explore."""
14
15    type: str = "ping_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                "always_filter": {
24                    "filters": self.get_required_filters("base_view"),
25                },
26                "joins": self.get_unnested_fields_joins_lookml(),
27            }
28        ]
29
30    @staticmethod
31    def from_views(views: List[View]) -> Iterator[PingExplore]:
32        """Generate all possible PingExplores from the views."""
33        for view in views:
34            if view.view_type == PingView.type:
35                yield PingExplore(view.name, {"base_view": view.name})
36
37    @staticmethod
38    def from_dict(name: str, defn: dict, views_path: Path) -> PingExplore:
39        """Get an instance of this explore from a name and dictionary definition."""
40        return PingExplore(name, defn["views"], views_path)
class PingExplore(generator.explores.explore.Explore):
13class PingExplore(Explore):
14    """A Ping Table explore."""
15
16    type: str = "ping_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                "always_filter": {
25                    "filters": self.get_required_filters("base_view"),
26                },
27                "joins": self.get_unnested_fields_joins_lookml(),
28            }
29        ]
30
31    @staticmethod
32    def from_views(views: List[View]) -> Iterator[PingExplore]:
33        """Generate all possible PingExplores from the views."""
34        for view in views:
35            if view.view_type == PingView.type:
36                yield PingExplore(view.name, {"base_view": view.name})
37
38    @staticmethod
39    def from_dict(name: str, defn: dict, views_path: Path) -> PingExplore:
40        """Get an instance of this explore from a name and dictionary definition."""
41        return PingExplore(name, defn["views"], views_path)

A Ping Table explore.

type: str = 'ping_explore'
@staticmethod
def from_views( views: List[generator.views.view.View]) -> Iterator[PingExplore]:
31    @staticmethod
32    def from_views(views: List[View]) -> Iterator[PingExplore]:
33        """Generate all possible PingExplores from the views."""
34        for view in views:
35            if view.view_type == PingView.type:
36                yield PingExplore(view.name, {"base_view": view.name})

Generate all possible PingExplores from the views.

@staticmethod
def from_dict( name: str, defn: dict, views_path: pathlib.Path) -> PingExplore:
38    @staticmethod
39    def from_dict(name: str, defn: dict, views_path: Path) -> PingExplore:
40        """Get an instance of this explore from a name and dictionary definition."""
41        return PingExplore(name, defn["views"], views_path)

Get an instance of this explore from a name and dictionary definition.