generator.dashboards.dashboard

Generic dashboard type.

 1"""Generic dashboard type."""
 2
 3from __future__ import annotations
 4
 5from dataclasses import dataclass, field
 6from typing import Dict, List
 7
 8
 9@dataclass
10class Dashboard(object):
11    """A generic Looker Dashboard."""
12
13    title: str
14    name: str
15    layout: str
16    namespace: str
17    tables: List[Dict[str, str]]
18    type: str = field(init=False)
19
20    def to_dict(self) -> dict:
21        """Dashboard instance represented as a dict."""
22        return {
23            self.name: {
24                "title": self.title,
25                "type": self.type,
26                "layout": self.layout,
27                "namespace": self.namespace,
28                "tables": self.tables,
29            }
30        }
31
32    def to_lookml(self):
33        """Generate Lookml for this dashboard."""
34        raise NotImplementedError("Only implemented in subclass.")
@dataclass
class Dashboard:
10@dataclass
11class Dashboard(object):
12    """A generic Looker Dashboard."""
13
14    title: str
15    name: str
16    layout: str
17    namespace: str
18    tables: List[Dict[str, str]]
19    type: str = field(init=False)
20
21    def to_dict(self) -> dict:
22        """Dashboard instance represented as a dict."""
23        return {
24            self.name: {
25                "title": self.title,
26                "type": self.type,
27                "layout": self.layout,
28                "namespace": self.namespace,
29                "tables": self.tables,
30            }
31        }
32
33    def to_lookml(self):
34        """Generate Lookml for this dashboard."""
35        raise NotImplementedError("Only implemented in subclass.")

A generic Looker Dashboard.

Dashboard( title: str, name: str, layout: str, namespace: str, tables: List[Dict[str, str]])
title: str
name: str
layout: str
namespace: str
tables: List[Dict[str, str]]
type: str
def to_dict(self) -> dict:
21    def to_dict(self) -> dict:
22        """Dashboard instance represented as a dict."""
23        return {
24            self.name: {
25                "title": self.title,
26                "type": self.type,
27                "layout": self.layout,
28                "namespace": self.namespace,
29                "tables": self.tables,
30            }
31        }

Dashboard instance represented as a dict.

def to_lookml(self):
33    def to_lookml(self):
34        """Generate Lookml for this dashboard."""
35        raise NotImplementedError("Only implemented in subclass.")

Generate Lookml for this dashboard.