Skip to main content

Looker (dagster-looker)

Dagster allows you to represent your Looker project as assets, alongside other your other technologies like dbt and Sling. This allows you to see how your Looker assets are connected to your other data assets, and how changes to other data assets might impact your Looker project.

Looker API

Here, we provide interfaces to manage Looker projects using the Looker API.

Assets (Looker API)

class dagster_looker.LookerResource
experimental

This API may break in future versions, even between dot releases.

Represents a connection to a Looker instance and provides methods to interact with the Looker API.

build_defs
deprecated

This API will be removed in version 1.9.0. Use dagster_looker.load_looker_asset_specs instead.

Returns a Definitions object which will load structures from the Looker instance and translate it into assets, using the provided translator.

Parameters:

Returns: A Definitions object which will contain return the Looker structures as assets.Return type: Definitions

class dagster_looker.DagsterLookerApiTranslator
get_asset_key
deprecated

This API will be removed in version 1.10. Use DagsterLookerApiTranslator.get_asset_spec().key instead.

get_asset_spec
class dagster_looker.LookerStructureData
class dagster_looker.LookerStructureType
class dagster_looker.RequestStartPdtBuild

A request to start a PDT build. See https://developers.looker.com/api/explorer/4.0/types/DerivedTable/RequestStartPdtBuild?sdk=py for documentation on all available fields.

Parameters:

  • model_name – The model of the PDT to start building.
  • view_name – The view name of the PDT to start building.
  • force_rebuild – Force rebuild of required dependent PDTs, even if they are already materialized.
  • force_full_incremental – Force involved incremental PDTs to fully re-materialize.
  • workspace – Workspace in which to materialize selected PDT (‘dev’ or default ‘production’).
  • source – The source of this request.
class dagster_looker.LookerFilter

Filters the set of Looker objects to fetch.

Parameters:

  • dashboard_folders (Optional[List[List[str]]]) – A list of folder paths to fetch dashboards from.
  • only_fetch_explores_used_in_dashboards (bool) – If True, only explores used in the fetched dashboards
dagster_looker.load_looker_asset_specs
experimental

This API may break in future versions, even between dot releases.

Returns a list of AssetSpecs representing the Looker structures.

Parameters:

Returns: The set of AssetSpecs representing the Looker structures.Return type: List[AssetSpec]

dagster_looker.build_looker_pdt_assets_definitions
experimental

This API may break in future versions, even between dot releases.

Returns the AssetsDefinitions of the executable assets for the given the list of refreshable PDTs.

Parameters:

Returns: The AssetsDefinitions of the executable assets for the given the list of refreshable PDTs.Return type: AssetsDefinition

lkml (LookML)

Here, we provide interfaces to manage Looker projects defined a set of locally accessible LookML files.

Assets (lkml)

dagster_looker.build_looker_asset_specs
experimental

This API may break in future versions, even between dot releases.

Build a list of asset specs from a set of Looker structures defined in a Looker project.

Parameters:

  • project_dir (Path) – The path to the Looker project directory.
  • dagster_looker_translator (Optional[DagsterLookerTranslator]) – Allows customizing how to

Examples:

from pathlib import Path

from dagster import external_assets_from_specs
from dagster_looker import build_looker_asset_specs


looker_specs = build_looker_asset_specs(project_dir=Path("my_looker_project"))
looker_assets = external_assets_from_specs(looker_specs)
class dagster_looker.DagsterLookerLkmlTranslator
experimental

This API may break in future versions, even between dot releases.

Holds a set of methods that derive Dagster asset definition metadata given a representation of a LookML structure (dashboards, explores, views).

This class is exposed so that methods can be overridden to customize how Dagster asset metadata is derived.

get_asset_key
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).key instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster asset key that represents the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide a custom asset key for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: The Dagster asset key that represents the LookML structure.Return type: AssetKey

get_asset_spec

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster asset spec that represents the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide a custom asset spec for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: The Dagster asset spec that represents the LookML structure.Return type: AssetSpec

get_deps
superseded

This API has been superseded and its usage is discouraged. Iterate over DagsterLookerLkmlTranslator.get_asset_spec(...).deps to access AssetDep.asset_key instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster dependencies of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide custom dependencies for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: The Dagster dependencies for the LookML structure.Return type: Sequence[AssetKey]

get_description
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).description instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster description of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide a custom description for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: The Dagster description for the LookML structure.Return type: Optional[str]

get_group_name
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).group_name instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster group name of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide a custom group name for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: A Dagster group name for the LookML structure.Return type: Optional[str]

get_metadata
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).metadata instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster metadata of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide custom metadata for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: A dictionary representing the Dagster metadata for the LookML structure.

Return type: Optional[Mapping[str, Any]]

get_owners
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).owners instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster owners of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide custom owners for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: A sequence of Dagster owners for the LookML structure.Return type: Optional[Sequence[str]]

get_tags
superseded

This API has been superseded and its usage is discouraged. Use DagsterLookerLkmlTranslator.get_asset_spec(...).tags instead..

A method that takes in a LookML structure (dashboards, explores, views) and returns the Dagster tags of the structure.

The LookML structure is parsed using lkml. You can learn more about this here: https://lkml.readthedocs.io/en/latest/simple.html.

You can learn more about LookML dashboards and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/param-lookml-dashboard.

You can learn more about LookML explores and views and the properties available in this dictionary here: https://cloud.google.com/looker/docs/reference/lookml-quick-reference.

This method can be overridden to provide custom tags for a LookML structure.

Parameters: lookml_structure (Tuple[Path, str, Mapping[str, Any]]) – A tuple with the path to file defining a LookML structure, the LookML structure type, and a dictionary representing a LookML structure.Returns: A dictionary representing the Dagster tags for the LookML structure.

Return type: Optional[Mapping[str, str]]