dbt 0.13.0 新添加特性sources 试用
dbt 0.13 添加了一个新的功能sources 我呢可以用来做以下事情
- 从基础模型的源表中进行数据选择
- 测试对于源数据的假设
- 计算源数据的
freshness
source 操作
- 定义source 模版格式
注意对于pg 等类型的,如果包含了schema 的可能需要配置额外参数,或者通过schema 约定
# This example defines a source called `source_1` containing one table
# called `table_1`. This is a minimal example of a source definition.
version: 2
sources:
- name: source_1
tables:
- name: table_1
- name: table_2
- name: source_2
tables:
- name: table_1
- schema 配置数据源格式
# This source entry describes the table:
# "raw"."public"."Orders_"
#
# It can be referenced with:
# {{ source('ecommerce', 'orders') }}
version: 2
sources:
- name: ecommerce
database: raw # Tell dbt to look for the source in the "raw" database
schema: public # You wouldn't put your source data in public, would you?
tables:
- name: orders
identifier: Orders_ # To alias table names to account for strange casing or naming of tables
一个简单例子
我配置的source 直接在model 文件夹中 可以参考https://github.com/rongfengliang/dbt-source-demo,关于表数据结构
也可以参考此项目
- 环境准备(使用python venv 管理)
python3 -m venv venv
source venv/bin/activate
pip install dbt
- 测试数据库准备(使用docker-compose)
version: '3.6'
services:
postgres:
image: postgres:9.6.11
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD:dalong"
graphql-engine:
image: hasura/graphql-engine:v1.0.0-beta.2
ports:
- "8080:8080"
depends_on:
- "postgres"
environment:
- "HASURA_GRAPHQL_DATABASE_URL=postgres://postgres:dalong@postgres:5432/postgres"
- "HASURA_GRAPHQL_ENABLE_CONSOLE=true"
- "HASURA_GRAPHQL_ENABLE_ALLOWLIST=true"
- model source 配置
models
├── apps
│ ├── app_summary.sql
│ └── sources.yml
└── users
├── sources.yml
├── user_summary.sql
└── user_summary2.sql
- source 内容
内容很简单,就是配置table
version: 2
sources:
- name: apps
schema: public
tables:
- name: apps
- 运行效果
dbt run
效果
Running with dbt=0.13.1
Found 3 models, 0 tests, 0 archives, 0 analyses, 94 macros, 0 operations, 0 seed files, 2 sources
17:43:42 | Concurrency: 3 threads (target='dev')
17:43:42 |
17:43:42 | 1 of 3 START view model public.app_summary........................... [RUN]
17:43:42 | 2 of 3 START view model public.user_summary.......................... [RUN]
17:43:42 | 3 of 3 START table model public.user_summary2........................ [RUN]
17:43:44 | 2 of 3 OK created view model public.user_summary..................... [CREATE VIEW in 0.26s]
17:43:45 | 1 of 3 OK created view model public.app_summary...................... [CREATE VIEW in 0.27s]
17:43:46 | 3 of 3 OK created table model public.user_summary2................... [SELECT 2 in 0.27s]
17:43:46 |
17:43:46 | Finished running 2 view models, 1 table models in 4.46s.
Completed successfully
Done. PASS=3 ERROR=0 SKIP=0 TOTAL=3
参考资料
https://github.com/rongfengliang/dbt-source-demo
dbt 0.13.0 新添加特性sources 试用的更多相关文章
- NVIDIA DIGITS 学习笔记(NVIDIA DIGITS-2.0 + Ubuntu 14.04 + CUDA 7.0 + cuDNN 7.0 + Caffe 0.13.0)
转自:http://blog.csdn.net/enjoyyl/article/details/47397505?from=timeline&isappinstalled=0#10006-we ...
- Pig安装及简单使用(pig版本0.13.0,Hadoop版本2.5.0)
原文地址:http://www.linuxidc.com/Linux/2014-03/99055.htm 我们用MapReduce进行数据分析.当业务比较复杂的时候,使用MapReduce将会是一个很 ...
- thrift接口描述语言 (基于thrift 0.13.0版本)
thrift接口描述语言(IDL)用来定义thrift类型. 一个Thrift IDL文件用来生成各种语言使用的结构体和服务. IDL中包含如下部分: 1. Document Document中包含0 ...
- 【Android 系统开发】CyanogenMod 13.0 源码下载 编译 ROM 制作 ( 手机平台 : 小米4 | 编译平台 : Ubuntu 14.04 LTS 虚拟机)
分类: Android 系统开发(5) 作者同类文章X 版权声明:本文为博主原创文章 ...
- hive-0.12升级成hive 0.13.1
安装了0.12之后,听说0.13.1有许多新的特性,包括永久函数,所以想更新成0.13版的(元数据放在mysql中) 2014年8月5日实验成功 hive0.13.1的新特性 新特性详见 http:/ ...
- CM12.1/13.0编译教程
环境搭建 1.安装64位Ubuntu系统(实体安装.虚拟机安装均可) 注意:要求机器至少4G内存(虚拟机至少分配4G内存),硬盘至少100G空间(源码20G+,编译后整个目录约60~70G) 安装方法 ...
- Oracle 11.2.0.4.0 Dataguard部署和日常维护(3)-Datauard监控篇
1. v$database 查看当前数据库的角色和保护模式 primary库查看 column NAME format a10 column PROTECTION_MODE format a2 ...
- Atitit. C#.net clr 2.0 4.0新特性
Atitit. C#.net clr 2.0 4.0新特性 1. CLR内部结构1 2. CLR 版本发展史3 3. CLR 2.0 3 4. CLR 4 新特性 概览4 4.1.1. 托管与本地 ...
- Netty 4.0 新的特性及需要注意的地方
Netty 4.0 新的特性及需要注意的地方 这篇文章和你一起过下Netty的主发行版本的一些显著的改变和新特性,让你在把你的应用程序转换到新版本的时候有个概念. 项目结构改变 Netty的包名从or ...
随机推荐
- Linux环境下进程的CPU占用率
阿里云服务器网站:https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=qqwovx6h 文字来源:http://www.s ...
- Latex中如何设置字体颜色(三种方式)
1.直接使用定义好的颜色 \usepackage{color} \textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text} 其中t ...
- hystrix,request collapser,请求合并
多个商品,需要发送多次网络请求,调用多次接口,才能拿到结果 可以使用HystrixCollapser将多个HystrixCommand合并到一起,多个command放在一个command里面去执行,发 ...
- Python进阶(九)----json模块, pickle模块, os模块,sys模块,hashlib模块
Python进阶----json模块, pickle模块, os模块,sys模块,hashlib模块 一丶序列化模块 什么是序列化: 将一种数据结构,转换成一个特殊的序列(特殊字符串,用于网络传输 ...
- Python基础知识(六)------小数据池,集合,深浅拷贝
Python基础知识(六)------小数据池,集合,深浅拷贝 一丶小数据池 什么是小数据池: 小数据池就是python中一种提高效率的方式,固定数据类型使用同一个内存地址 代码块 : 一个文 ...
- Windows安装MySQL5.7教程
导读: 我们日常学习可能会需要在本地安装MySQL服务,也遇到过小伙伴探讨关于Windows系统安装MySQL的问题.在这里建议大家安装MySQL5.7版本,当然想尝试8.0版本的同学也可以参考安装. ...
- Gitlab创建一个项目
1.安装git yum install git 2.生成密钥文件:使用ssh-keygen生成密钥文件.ssh/id_rsa.pub ssh-keygen 执行过程中输入密码,以及确认密码,并可设置密 ...
- secureCRT 中各种传输协议分析 启动daemon运行守护进程(转)
转载链接:http://blog.sina.com.cn/s/blog_61798d5d01018yk4.html [Telnet]著名的终端访问协议,传统的网络服务程序,如FTP.POP和Telne ...
- Linux命令——lsblk
参考:Linux lsblk Command Tutorial for Beginners (8 Examples) 简介 lsblk可以看成是“List block device”的缩写,即列为出所 ...
- Linux之RHEL7root密码破解(二)
破解Linux root密码的第二种方法,如下: 首先开机,进入启动界面,接着找到如下图所示的代码字段,将ro改成rw init=/sysroot/bin/sh ,如下图: 之后按“Ctrl+X”之后 ...