seed 可以方便的进行数据的导入,可以方便的进行不变数据(少量)以及测试数据的导入,
base 设置为 ephemeral(暂态),这个同时也是官方最佳实践的建议

项目依赖的gitlab 数据可以参考https://github.com/rongfengliang/graphql-engine-gitlab

参考项目

  • 初始化
dbt init  gitlab-data
  • 配置项目
# Name your package! Package names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'gitlab'
version: '1.0' # This setting configures which "profile" dbt uses for this project. Profiles contain
# database connection information, and should be configured in the ~/.dbt/profiles.yml file
profile: 'default' # These configurations specify where dbt should look for different types of files.
# The `source-paths` config, for example, states that source models can be found
# in the "models/" directory. You probably won't need to change these!
source-paths: ["models"]
analysis-paths: ["analysis"]
test-paths: ["tests"]
data-paths: ["data"] # 可以放seed 数据
macro-paths: ["macros"] target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_modules" # You can define configurations for models in the `source-paths` directory here.
# Using these configurations, you can enable or disable models, change how they
# are materialized, and more! # In this example config, we tell dbt to build all models in the example/ directory
# as views (the default). Try changing `view` to `table` below, then re-running dbt
models:
gitlab:
gitlab:
base:
materialized: ephemeral # base 建议配置为ephemeral
  • 模型添加
model/gitlab/base/gitlab_projectinfo.sql:
select * from projects model/gitlab/transform/gitlab_project_counts.sql:
select * from {{ref('gitlab_projectinfo')}}

profile 配置

~/.dbt/profiles.yml
default:
target: dev
outputs:
dev:
type: postgres
host: 127.0.0.1
user: postgres
pass: password
port: 5432
dbname: gitlabhq_production
schema: public
threads: 3
pg:
target: dev
outputs:
dev:
type: postgres
host: 127.0.0.1
user: postgres
pass: password
port: 5433
dbname: gitlabhq_production
schema: public
threads: 3

运行&&测试&&文档

  • 运行
dbt run && dbt seed --show && dbt docs generate && dbt docs serve
  • 效果


参考资料

https://github.com/rongfengliang/graphql-engine-gitlab
https://docs.getdbt.com/docs/configuring-models
https://docs.getdbt.com/docs/best-practices
https://docs.getdbt.com/reference#seed

 
 
 
 

dbt seed 以及base ephemeral使用的更多相关文章

  1. ACdream 1104 瑶瑶想找回文串(SplayTree + Hash + 二分)

    Problem Description 刚学完后缀数组求回文串的瑶瑶(tsyao)想到了另一个问题:如果能够对字符串做一些修改,怎么在每次询问时知道以某个字符为中心的最长回文串长度呢?因为瑶瑶整天只知 ...

  2. POJ3261-哈希

    这个题让求至少出现K次的最大长度的子串,属于最大化最小值问题,首先应该想到二分求字串的长度,二分的过程是O(logN)的,注意judge的时候怎样判断是否满足情况以及满足情况后l,r的变化.可以给每一 ...

  3. HDOJ--4821--String【弦hash】

    联系:http://acm.hdu.edu.cn/showproblem.php?pid=4821 题意:给一个字符串,选m个长度为l的子串组成新的串.要求这m个子串互不同样,问有多少种组合. 字符串 ...

  4. 矩阵hash + KMP - UVA 12886 The Big Painting

    The Big Painting Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=88791 M ...

  5. (通俗易懂小白入门)字符串Hash+map判重——暴力且优雅

    字符串Hash 今天我们要讲解的是用于处理字符串匹配查重的一个算法,当我们处理一些问题如给出10000个字符串输出其中不同的个数,或者给一个长度100000的字符串,找出其中相同的字符串有多少个(这样 ...

  6. 18.翻译系列:EF 6 Code-First 中的Seed Data(种子数据或原始测试数据)【EF 6 Code-First系列】

    原文链接:https://www.entityframeworktutorial.net/code-first/seed-database-in-code-first.aspx EF 6 Code-F ...

  7. dbt 包依赖简单测试

    dbt 包含一个自己的包管理,可以使用git 等工具,还是很方便的,可以方便的进行代码共享,实现复用 创建简单包 实际上就是一个简单的dbt 项目,参考项目 https://gitlab.com/da ...

  8. dbt 包的构建

    dbt的包是一种可以复用的代码,可以方便进行模型的共享 创建一个包 和普通的dbt 项目类似 初始化(init) dbt init [packagename] 目录结构 文件: README.md d ...

  9. Entity Framework Code-First(19):Seed Data

    Seed Database in Code-First: You can insert data into your database tables during the database initi ...

随机推荐

  1. win10 自己DIY的arp绑定小脚本

    @echo off&mode con cols=80 lines=22&title ARP_bind Tools setlocal enabledelayedexpansion rem ...

  2. js获取表格视图所选行号的ids

    实例化数组 遍历所选行push到数组中 将数组join转换为以,分割的字符串 /*获取指定id的datagrid的表格视图的选择的ids*/ function getDataGridSelectRow ...

  3. Python解析Wav文件并绘制波形的方法

    资源下载 #本文PDF版下载 Python解析Wav文件并绘制波形的方法 #本文代码下载 Wav波形绘图代码 #本文实例音频文件night.wav下载 音频文件下载 (石进-夜的钢琴曲) 前言 在现在 ...

  4. MySQL Replication 线程(理解详细过程)

    Replication 线程 Mysql 的Replication 是一个异步的复制过程,从一个Mysql instace(我们称之为Master)复制到另一个Mysql instance(我们称之S ...

  5. ccf消除类游戏

    问题描述 消除类游戏是深受大众欢迎的一种游戏,游戏在一个包含有n行m列的游戏棋盘上进行,棋盘的每一行每一列的方格上放着一个有颜色的棋子,当一行或一列上有连续三个或更多的相同颜色的棋子时,这些棋子都被消 ...

  6. ASP.NET的路由系统

    一.URL与物理文件的分离 1.URL与物理文件的分离 对于一个 ASP.NET Web Form应用来说,任何一个请求都对应着某个具体的物理文件.部署在Web服务器上的物理文件可以是静态的(比如图片 ...

  7. JavaScript学习总结(十三)——极简主义法编写JavaScript类

    前两天在网上无意中发现了一篇使用极简主义法定义JavaScript类的文章,原文链接,这个所谓的"极简主义法"我还是第一次听说,是荷兰程序员Gabor de Mooij提出来的,这 ...

  8. POJ 3259 Bellman_Ford算法

    额.关键是读题.反正我是看了解题报告才知道意思的.给你n个点.m条路.双向的.耗费时间.w个虫洞.单向的.时间为负值.问你是否可以从某一点返回看到之前的自己.即为判断是不是有负环.用Bellman_F ...

  9. UVALive 4490 压缩DP

    转载自http://blog.csdn.net/zstu_zlj/article/details/9903589 没有接触过压缩DP.位运算也不太熟.所以理解了思路还是不懂代码.

  10. jw

    1.  ISO/OSI参考模型(七层)  应表会传 传输介质(双绞线,同轴电缆等)不在OSI7个层次之内 电气特性:电压表示0,1: 机械特性:接口形状,尺寸等 过程特性:出现顺序及信号线的工作原理 ...