metabase

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

metabase

Usage

source:
  name: metabase
  config:
    host: http://localhost:3000
    instance_label: my-metabase
    username: meteor_tester
    password: meteor_pass_1234

Inputs

Key Value Example Description
host string http://localhost:4002 The host at which metabase is running required
instance_label string my-metabase Instance alias, the value will be used as part of the urn component required
username string meteor_tester Username/email to access the metabase optional
password string meteor_pass_1234 Password for the metabase optional
session_id string meteor_pass_1234 Use existing session ID from metabase to create requests. (this will ignore username and password) optional

Outputs

Field Sample Value
resource.urn metabase::my-metabase/dashboard/5123
resource.name dashboard_name
resource.service metabase
description table description
charts []Chart
Chart
Field Sample Value
urn metabase::my-metabase/card/9123
source metabase
dashboard_urn metabase::my-metabase/dashboard/5123
dashboard_source metabase

Contributing

Refer to the contribution guidelines for information on contributing to this module.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	ID                   int              `json:"id"`
	CollectionID         int              `json:"collection_id"`
	DatabaseID           int              `json:"database_id"`
	TableID              int              `json:"table_id"`
	CreatorID            int              `json:"creator_id"`
	Name                 string           `json:"name"`
	QueryAverageDuration int              `json:"query_average_duration"`
	Description          string           `json:"description"`
	Display              string           `json:"display"`
	CreatedAt            MetabaseTime     `json:"created_at"`
	UpdatedAt            MetabaseTime     `json:"updated_at"`
	DatasetQuery         CardDatasetQuery `json:"dataset_query"`
	Archived             bool             `json:"archived"`
}

type CardDatasetQuery

type CardDatasetQuery struct {
	Type  string `json:"type"`
	Query struct {
		SourceTable int           `json:"source-table"`
		Filter      []interface{} `json:"filter"`
	} `json:"query"`
	Native   NativeDatasetQuery `json:"native"`
	Database int                `json:"database"`
}

type CardResultMetadata

type CardResultMetadata struct {
	ID            int          `json:"id"`
	Name          string       `json:"name"`
	DisplayName   string       `json:"display_name"`
	BaseType      string       `json:"base_type"`
	EffectiveType string       `json:"effective_type"`
	SemanticType  string       `json:"semantic_type"`
	Description   string       `json:"description"`
	Unit          string       `json:"unit"`
	FieldRef      []string     `json:"field_ref"`
	CreatedAt     MetabaseTime `json:"created_at"`
	UpdatedAt     MetabaseTime `json:"updated_at"`
}

type Client

type Client interface {
	Authenticate(host, username, password, sessionID string) error
	GetDatabase(int) (Database, error)
	GetTable(int) (Table, error)
	GetDashboard(int) (Dashboard, error)
	GetDashboards() ([]Dashboard, error)
}

type Collection

type Collection struct {
	ID          int          `json:"id"`
	Name        string       `json:"name"`
	Color       string       `json:"color"`
	Description string       `json:"description"`
	CreatedAt   MetabaseTime `json:"created_at"`
	UpdatedAt   MetabaseTime `json:"updated_at"`
}

type Config

type Config struct {
	Host          string `mapstructure:"host" validate:"required"`
	InstanceLabel string `mapstructure:"instance_label" validate:"required"`
	Username      string `mapstructure:"username" validate:"required_without=SessionID"`
	Password      string `mapstructure:"password"`
	SessionID     string `mapstructure:"session_id"`
}

Config holds the set of configuration for the metabase extractor

type Dashboard

type Dashboard struct {
	ID           int          `json:"id"`
	CreatorID    int          `json:"creator_id"`
	CollectionID int          `json:"collection_id"`
	Name         string       `json:"name"`
	Description  string       `json:"description"`
	CreatedAt    MetabaseTime `json:"created_at"`
	UpdatedAt    MetabaseTime `json:"updated_at"`
	OrderedCards []struct {
		CardID int  `json:"card_id"`
		Card   Card `json:"card"`
	} `json:"ordered_cards"`
	LastEditInfo struct {
		Id        string    `json:"id"`
		Email     string    `json:"email"`
		Timestamp time.Time `json:"timestamp"`
	}
}

type Database

type Database struct {
	ID                       int          `json:"id"`
	DbID                     int          `json:"db_id"`
	Name                     string       `json:"name"`
	Features                 []string     `json:"features"`
	Description              string       `json:"description"`
	Timezone                 string       `json:"timezone"`
	Engine                   string       `json:"engine"`
	MetadataSyncSchedule     string       `json:"metadata_sync_schedule"`
	CacheFieldValuesSchedule string       `json:"cache_field_values_schedule"`
	AutoRunQueries           bool         `json:"auto_run_queries"`
	IsFullSync               bool         `json:"is_full_sync"`
	IsSample                 bool         `json:"is_sample"`
	IsOnDemand               bool         `json:"is_on_demand"`
	CreatedAt                MetabaseTime `json:"created_at"`
	UpdatedAt                MetabaseTime `json:"updated_at"`
	Details                  struct {
		Db                string      `json:"db"`
		Host              string      `json:"host"`
		Port              int         `json:"port"`
		Dbname            string      `json:"dbname"`
		User              string      `json:"user"`
		Password          string      `json:"password"`
		SSL               bool        `json:"ssl"`
		AdditionalOptions interface{} `json:"additional-options"`
		TunnelEnabled     bool        `json:"tunnel-enabled"`
		ProjectID         string      `json:"project-id"`
		DatasetID         string      `json:"dataset-id"`
	} `json:"details"`
}

type Extractor

type Extractor struct {
	plugins.BaseExtractor
	// contains filtered or unexported fields
}

Extractor manages the extraction of data from the metabase server

func New

func New(client Client, logger log.Logger) *Extractor

New returns a pointer to an initialized Extractor Object

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) (err error)

Extract collects the metadata from the source. The metadata is collected through the out channel

func (*Extractor) Init

func (e *Extractor) Init(ctx context.Context, config plugins.Config) (err error)

type MetabaseTime

type MetabaseTime time.Time

func (MetabaseTime) ToPB

func (mt MetabaseTime) ToPB() *timestamppb.Timestamp

func (*MetabaseTime) UnmarshalJSON

func (mt *MetabaseTime) UnmarshalJSON(b []byte) error

type NativeDatasetQuery

type NativeDatasetQuery struct {
	Query        string                      `json:"query"`
	TemplateTags map[string]QueryTemplateTag `json:"template-tags"`
}

type QueryTemplateTag

type QueryTemplateTag struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	DisplayName string `json:"display-name"`
}

type Table

type Table struct {
	ID          int          `json:"id"`
	DbID        int          `json:"db_id"`
	Name        string       `json:"name"`
	DisplayName string       `json:"display_name"`
	Description string       `json:"description"`
	FieldOrder  string       `json:"field_order"`
	EntityType  string       `json:"entity_type"`
	Schema      string       `json:"schema"`
	Active      bool         `json:"active"`
	CreatedAt   MetabaseTime `json:"created_at"`
	UpdatedAt   MetabaseTime `json:"updated_at"`
	Db          Database     `json:"db"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL