A dbt macro that generates a Snowflake Semantic View from a dbt semantic model.
- Copy
generate_semantic_view.sqlinto yourmacros/directory. - Add
Snowflake-Labs/dbt_semantic_viewto yourpackages.ymland rundbt deps.
packages.yml:
| import angular from 'angular'; | |
| function copy(source, target) { | |
| Object.keys(source).forEach((key) => { | |
| target[key] = source[key]; | |
| }); | |
| return target; | |
| } | |
| function fromCamelCase(string, separator = '_') { |
| class Potion { | |
| /** | |
| * | |
| * @param {function} fetch for GET requests to look up references | |
| * @param {object} constructors a map of resource URIs to constructors, e.g. {'/type': Type} | |
| * @param {function} defaultConstructor an optional fallback for other types | |
| * @param {string} prefix an optional API prefix | |
| * @param {object} cache an optional cache object with get(string), put(string, object) and remove(string) methods | |
| */ |
| #!/usr/bin/env python | |
| from base64 import b64decode | |
| from flask import Flask, current_app | |
| from flask_sqlalchemy import SQLAlchemy | |
| from flask_presst import PresstApi, ModelResource | |
| from flask_presst.principal import PrincipalResource | |
| from flask_login import LoginManager, UserMixin, current_user, login_required, user_logged_in, user_logged_out | |
| from flask_principal import UserNeed, RoleNeed, Principal, Identity, AnonymousIdentity, identity_changed, \ |
| $resourceMinErr = angular.$$minErr('$resource') | |
| angular.module('resources', []) | |
| .provider 'Resource', () -> | |
| provider = @ | |
| provider.prefix = '/api/v1' | |
| provider.uriField = 'resource_uri' | |
| class ResourceBase |
| // includes bindings for fetching/fetched | |
| var PaginatedCollection = Backbone.Collection.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage', 'filtrate', 'sort_by'); | |
| typeof(options) != 'undefined' || (options = {}); | |
| typeof(this.limit) != 'undefined' || (this.limit = 20); | |
| typeof(this.offset) != 'undefined' || (this.offset = 0); | |
| typeof(this.filter_options) != 'undefined' || (this.filter_options = {}); | |
| typeof(this.sort_field) != 'undefined' || (this.sort_field = ''); |