{"id":18853718,"url":"https://github.com/bytehouse-cloud/bytehouse-dbt","last_synced_at":"2026-02-03T19:32:56.807Z","repository":{"id":65781474,"uuid":"599676751","full_name":"bytehouse-cloud/bytehouse-dbt","owner":"bytehouse-cloud","description":"dbt Connector for ByteHouse","archived":false,"fork":false,"pushed_at":"2023-02-09T17:05:24.000Z","size":1264,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-28T00:03:10.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytehouse-cloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-09T16:42:12.000Z","updated_at":"2023-02-17T06:53:13.000Z","dependencies_parsed_at":"2023-02-23T03:15:42.005Z","dependency_job_id":null,"html_url":"https://github.com/bytehouse-cloud/bytehouse-dbt","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"886247c34977cb16f11644d10917a3e901807781"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bytehouse-cloud/bytehouse-dbt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytehouse-cloud%2Fbytehouse-dbt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytehouse-cloud%2Fbytehouse-dbt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytehouse-cloud%2Fbytehouse-dbt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytehouse-cloud%2Fbytehouse-dbt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytehouse-cloud","download_url":"https://codeload.github.com/bytehouse-cloud/bytehouse-dbt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytehouse-cloud%2Fbytehouse-dbt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29054728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T15:43:47.601Z","status":"ssl_error","status_checked_at":"2026-02-03T15:43:46.709Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T03:45:24.391Z","updated_at":"2026-02-03T19:32:56.791Z","avatar_url":"https://github.com/bytehouse-cloud.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n`dbt` (Data Building Tool) is an open source tool that enables data analysts and engineers to transform\ndata in their warehouses simply by writing select statements. `dbt` performs the T (Transform) of ETL and\nallows companies to write transformations as queries and orchestrate them in a more efficient way. \nByteHouse dbt connector is a plugin enabling users to build their data warehouse ecosystem with dbt \nand ByteHouse. \n# Table of Contents\n- [Introduction](#introduction)\n- [Requirements](#requirements)\n- [Creating ByteHouse Account](#creating-bytehouse-account)\n- [Installation](#installation)\n- [dbt Project Setup](#dbt-project-setup)\n  * [dbt_project.yml](#dbt-projectyml)\n  * [profiles.yml](#profilesyml)\n  * [Connection \u0026 Authentication Configurations](#connection---authentication-configurations)\n    + [ByteHouse Regions](#bytehouse-regions)\n    + [Region \u0026 Password Configuration](#region---password-configuration)\n    + [Region \u0026 API Key Configuration](#region---api-key-configuration)\n    + [Host Address \u0026 Password Configuration](#host-address---password-configuration)\n    + [Host Address \u0026 API Key Configuration](#host-address---api-key-configuration)\n  * [Project Initialization](#project-initialization)\n  * [Test Warehouse Connection](#test-warehouse-connection)\n- [Dataset Ingestion](#dataset-ingestion)\n- [dbt Models](#dbt-models)\n- [schema.yml](#schemayml)\n- [Materialization types of Models](#materialization-types-of-models)\n  * [View Materializations](#view-materializations)\n  * [Table Materializations](#table-materializations)\n  * [Incremental Materializations](#incremental-materializations)\n    + [How it works](#how-it-works)\n- [Project Documentation](#project-documentation)\n- [Local Development](#local-development)\n- [Original Author](#original-author)\n- [License](#license)\n# Requirements\nMake sure you have `dbt` \u0026 `python` installed on your machine. If not, then you can follow this guide https://docs.getdbt.com/docs/get-started/installation\n- dbt v1.3.0 or greater\n- python v3.7 or greater\n# Creating ByteHouse Account\nYou need to create ByteHouse account in order to use bytehouse-dbt connector. You can simply create a free account with\nthe process mentioned in our official website documentation: https://docs.bytehouse.cloud/en/docs/quick-start \u003cbr/\u003e\n\nYou can also create ByteHouse account through Volcano Engine by ByteDance: \nhttps://www.volcengine.com/product/bytehouse-cloud \n# Installation\nCreate a new repository where we will instantiate a `Python` virtual environment.\n```commandline\nmkdir dbt_bytehouse_demo\ncd dbt_bytehouse_demo\n\npython -m venv venv\nsource venv/bin/activate\n```\nLatest release version can be installed from here:\n```commandline\npip install dbt-bytehouse\n```\nCurrent development version can be installed from here:\n```commandline\npip install git+https://github.com/bytehouse-cloud/bytehouse-dbt@master#egg=bytehouse-driver\n```\nCheck whether installation is successful by verifying bytehouse is available under Plugins.\n```commandline\ndbt --version\n```\n![Version](./examples/1_version.png)\n# dbt Project Setup\n## dbt_project.yml\nEvery `dbt` project needs a `dbt_project.yml` file — this is how `dbt` knows a directory is a `dbt` project. `dbt_project.yml`\nfile holds the context of your project and tells `dbt` how to build your data sets. Some common configurations\nfor `dbt_project.yml` are:\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eYAML key\u003c/td\u003e\n        \u003ctd\u003eValue\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ename\u003c/td\u003e\n        \u003ctd\u003eYour project’s name in snake case\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eversion\u003c/td\u003e\n        \u003ctd\u003eVersion of your project\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eprofile\u003c/td\u003e\n        \u003ctd\u003eThe profile dbt uses to connect to ByteHouse\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003emodel-paths\u003c/td\u003e\n        \u003ctd\u003eDirectories to where your model and source files live\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eseed-paths\u003c/td\u003e\n        \u003ctd\u003eDirectories to where your seed files live\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003etest-paths\u003c/td\u003e\n        \u003ctd\u003eDirectories to where your test files live\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003esnapshot-paths\u003c/td\u003e\n        \u003ctd\u003eDirectories to where your snapshots live\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003edocs-paths\u003c/td\u003e\n        \u003ctd\u003eDirectories to where your docs blocks live\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n## profiles.yml\nWhen you invoke `dbt` from the command line, `dbt` parses your `dbt_project.yml` and obtains the profile name. `dbt` then \nchecks your `profiles.yml` file for a profile with the same name. A profile contains all the details/credentials \nrequired to connect to ByteHouse. `dbt` will search the current working directory for the `profiles.yml` file and will\ndefault to the `~/.dbt/ directory` if not found.\n```yaml\n\u003cprofile-name\u003e:\n  target: \u003ctarget-name\u003e\n  outputs:\n    \u003ctarget-name\u003e:\n      type: bytehouse\n      schema: \u003cdatabase-name\u003e\n      user: \u003cusername\u003e\n      password: \u003cpassword\u003e\n      driver: native\n      #optional fields\n      host: \u003chostname\u003e\n      port: \u003cport\u003e\n      region: \u003cregion-name\u003e\n      account: \u003caccount-name\u003e\n      warehouse: \u003cwarehouse-name\u003e\n      retries: 1\n      secure: True\n      connect_timeout: 10\n      send_receive_timeout: 300\n      custom_settings: \u003cempty\u003e\n```\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eYAML key\u003c/td\u003e\n        \u003ctd\u003eValue\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e\u0026lt;profile-name\u0026gt;\u003c/td\u003e\n        \u003ctd\u003eName of the profile. Has to be the same name as the profile indicated in your dbt_project.yml file\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003etarget\u003c/td\u003e\n        \u003ctd\u003eDefault target your dbt project will use. It must be one of the targets you define in your profile\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003etype\u003c/td\u003e\n        \u003ctd\u003eMust be set to bytehouse\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eschema\u003c/td\u003e\n        \u003ctd\u003eDatabase name\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003euser\u003c/td\u003e\n        \u003ctd\u003eUsername with adequate permissions to access the specified schema. For API Key authentication, user must be set to bytehouse\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003epassword\u003c/td\u003e\n        \u003ctd\u003eThe password associated with the specified user\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003edriver\u003c/td\u003e\n        \u003ctd\u003eMust be set to native\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ehost\u003c/td\u003e\n        \u003ctd\u003e[Optional] The host name of the connection\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eport \u003c/td\u003e\n        \u003ctd\u003e[Optional] The port number of the host server\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eregion\u003c/td\u003e\n        \u003ctd\u003e[Optional] Alias for host \u0026amp; port \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eaccount\u003c/td\u003e\n        \u003ctd\u003e[Optional] ByteHouse account number\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ewarehouse\u003c/td\u003e\n        \u003ctd\u003e[Optional] The name of the virtual warehouse that you want to use for this session\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eretries\u003c/td\u003e\n        \u003ctd\u003e[Optional] Number of times to retry the initial connection attempt if the error appears to be recoverable\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003esecure\u003c/td\u003e\n        \u003ctd\u003e[Optional] Whether the connection is secured by TLS. Suggested to set it to True\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003econnect_timeout\u003c/td\u003e\n        \u003ctd\u003e[Optional] Connection timeout in seconds. Default is 10 seconds\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003esend_receive_timeout\u003c/td\u003e\n        \u003ctd\u003e[Optional] Timeout for receiving data from or sending data to ByteHouse. Default is 5 minutes (300 seconds)\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003ecustom_settings\u003c/td\u003e\n        \u003ctd\u003e[Optional] A mapping of ByteHouse specific user settings to use with the connection\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n## Connection \u0026 Authentication Configurations\n### ByteHouse Regions\nCurrently, the driver supports the following region names across different cloud providers. Alternatively, if you know\nthe host address of ByteHouse server, you can directly use host address \u0026 omit region name.\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eRegion Name\u003c/td\u003e\n        \u003ctd\u003eTarget Server\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eAP-SOUTHEAST-1\u003c/td\u003e\n        \u003ctd\u003egateway.aws-ap-southeast-1.bytehouse.cloud:19000\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003eVOLCANO-CN-NORTH-1\u003c/td\u003e\n        \u003ctd\u003ebytehouse-cn-beijing.volces.com:19000\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n### Region \u0026 Password Configuration\nRequired parameters: `account` `user` `password` `region`\n```yaml\nbytehouse_profile:\n  target: dev\n  outputs:\n    dev:\n      type: bytehouse\n      driver: native\n\n      # database\n      schema: $DATABASE_NAME\n\n      # target server address\n      region: $REGION_NAME\n\n      # account credentials\n      account: $ACCOUNT_NAME\n      user: $USER_NAME\n      password: $PASSWORD\n\n      # additional settings\n      secure: True\n```\n### Region \u0026 API Key Configuration\nRequired parameters: `region` `user` `password`\n```yaml\nbytehouse_profile:\n  target: dev\n  outputs:\n    dev:\n      type: bytehouse\n      driver: native\n\n      # database\n      schema: $DATABASE_NAME\n\n      # target server address\n      region: $REGION_NAME\n\n      # account credentials\n      user: bytehouse\n      password: $API_KEY\n\n      # additional settings\n      secure: True\n```\n### Host Address \u0026 Password Configuration\nRequired parameters: `host` `port` `account` `user` `password`\n```yaml\nbytehouse_profile:\n  target: dev\n  outputs:\n    dev:\n      type: bytehouse\n      driver: native\n\n      # database\n      schema: $DATABASE_NAME\n\n      # target server address\n      host: $HOST_ADDRESS  \n      port: $PORT_NUMBER\n\n      # account credentials\n      account: $ACCOUNT_NAME\n      user: $USER_NAME\n      password: $PASSWORD\n\n      # additional settings\n      secure: True\n```\n### Host Address \u0026 API Key Configuration\nRequired parameters: `host` `port` `user` `password`\n```yaml\nbytehouse_profile:\n  target: dev\n  outputs:\n    dev:\n      type: bytehouse\n      driver: native\n\n      # database\n      schema: $DATABASE_NAME\n\n      # target server address\n      host: $HOST_ADDRESS  \n      port: $PORT_NUMBER\n\n      # account credentials\n      user: bytehouse\n      password: $API_KEY\n\n      # additional settings\n      secure: True\n```\n## Project Initialization\n`dbt init` command will prompt for project name \u0026 database adapters, where you have to select bytehouse. This will create\na new folder with your project name, sample files \u0026 `dbt_project.yml` config file, enough to get you started with dbt.\n```commandline\ndbt init\n```\n![Init](./examples/2_profiles.png)\nUpdate your profiles.yml with required authentication \u0026 target server credentials. \n```commandline\nnano ~/.dbt/profiles.yml\n```\nAs `dbt` has created a new folder with the same name as your project name, change your current \ndirectory to the project folder. \n```commandline\ncd dbt_bytehouse_demo\n```\nUpdate your `dbt_project.yml` file to have the same profile_name as `~/.dbt/profiles.yml`.\n```commandline\nnano dbt_project.yml\n```\n![Project](./examples/3_project.png)\n## Test Warehouse Connection\nUse `dbt debug` command to verify required dependencies \u0026 warehouse connection. In case of success, it will show you \n\"All checks passed!\"\n```commandline\ndbt debug\n```\n![Debug](./examples/4_debug.png)\n# Dataset Ingestion\nTo showcase different `dbt` functionalities, we will ingest a small imdb movie dataset, with the following schema. \nThe DDL \u0026 insertion queries can be found here https://github.com/bytehouse-cloud/bytehouse-dbt/examples/data_loading.sql. \nYou can use ByteHouse SQL worksheet to create the schema \u0026 insert the dataset. \n![Schema](./examples/5_schema.png)\nTo verify that dataset preparation was successful, we will execute this following query to summarize each actor along \nwith their total number of movie appearances. \n```\nSELECT id,\n  any(actor_name) as name,\n  uniqExact(movie_id)    as num_movies,\n  avg(rating)                as avg_rating,\n  max(created_at) as updated_at\nFROM (\n  SELECT actors.id as id,\n       concat(actors.first_name, ' ', actors.last_name) as actor_name,\n       movies.id as movie_id,\n       movies.rating as rating,\n       created_at\n  FROM  imdb.actors\n        JOIN imdb.roles ON roles.actor_id = actors.id\n        LEFT OUTER JOIN imdb.movies ON movies.id = roles.movie_id\n)\nGROUP BY id\n```\nThe resultset should be like this:\n![Schema Confirm](./examples/6_schema_confirm.png)\n# dbt Models \nIn a `dbt` project, a model is a sql file located inside `models/` directory which will contain a `SELECT` statement \nreferring to a transformation. The name of the model file will refer to the name of future table/view after\n`dbt` execution. When we execute `dbt run` command, `dbt` will build this model directly into ByteHouse by wrapping\nit in a create table / view materialization. Materialization type of your model will determine the actual SQL\nthat `dbt` will use to create model in the warehouse.\n# schema.yml\nThe `schema.yml` file will define our tables \u0026 columns by referring through alias name. This schemas can later be\nused in different models/macros via `source()` function.\nCreate `schema.yml` file under `models/` directory\n```commandline\ntouch models/schema.yml\n```\nDefine our model schema like this\n```yaml\nversion: 2\n\nsources:\n- name: imdb\n  tables:\n  - name: actors\n  - name: roles\n  - name: movies\n```\n# Materialization types of Models\n## View Materializations\nIn case of view materialization, a model is transformed to a view on each single run by `CREATE VIEW` AS statement in \nByteHouse. View materializations won't store the actual data, so it would be slower to query than table materializations.\nLet's create `models/actor_insight.sql` as view materialization. \n```commandline\ntouch models/actors_insight.sql\n```\n```\n{{ config(materialized='view') }}\n\nSELECT id,\n  any(actor_name) as name,\n  uniqExact(movie_id)    as num_movies,\n  avg(rating)                as avg_rating,\n  max(created_at) as updated_at\nFROM (\n  SELECT actors.id as id,\n       concat(actors.first_name, ' ', actors.last_name) as actor_name,\n       movies.id as movie_id,\n       movies.rating as rating,\n       created_at\n  FROM  {{ source('imdb', 'actors') }}\n        JOIN {{ source('imdb', 'roles') }} ON roles.actor_id = actors.id\n        LEFT OUTER JOIN {{ source('imdb', 'movies') }} ON movies.id = roles.movie_id\n)\nGROUP BY id\n```\nLet's execute `dbt run` command to build this model in ByteHouse. \n![Confirm](./examples/7_actor_insight_confirm.png)\nQuerying this view, we can replicate the results of our earlier query with a simpler syntax:\n```\nSELECT * FROM imdb.actors_insight ORDER BY num_movies DESC;\n```\n![Confirm2](./examples/8_materialized_view_run_confirm.png)\n## Table Materializations\nIn case of table materialization, your model would be rebuilt as a table on each single `dbt run` \nvia a `CREATE TABLE` AS statement. \n```commandline\ntouch models/actors_insight_table.sql\n```\nWe can use our previous view materialization sql with config change for table materialization sql. \n```\n{{ config(order_by='(updated_at, id, name)', materialized='table') }}\n```\nWe can verify that both view \u0026 table materializations generate the same response. \n```\n SELECT * FROM imdb.actors_insight_table ORDER BY num_movies DESC;\n```\n## Incremental Materializations\nFor our previous table materialization, `dbt` will construct a table every time to materialize the model. For larger\nor complex transformations, this would be redundant and costly in terms of computing power. Incremental \nmaterializations solve this problem.\u003cbr/\u003e\nThe first time a model is run, the table is built by transforming all rows of source data. On subsequent runs, \n`dbt` transforms only the rows in your source data that you tell `dbt` to filter for, inserting them into the target \ntable which is the table that has already been built.\u003cbr/\u003e\nTo tell `dbt` which rows it should transform on an incremental run, wrap valid SQL that filters for these rows \nin the `is_incremental()` macro. Your `is_incremental()` code will check for rows created or modified since the \nlast time `dbt` ran this model.\n```commandline\ntouch models/actors_insight_incremental.sql\n```\n```\n{{ config(order_by='(updated_at, id, name)', materialized='incremental') }}\n\nSELECT id,\n  any(actor_name) as name,\n  uniqExact(movie_id)    as num_movies,\n  avg(rating)                as avg_rating,\n  max(created_at) as updated_at\nFROM (\n  SELECT actors.id as id,\n       concat(actors.first_name, ' ', actors.last_name) as actor_name,\n       movies.id as movie_id,\n       movies.rating as rating,\n       created_at\n  FROM  {{ source('imdb', 'actors') }}\n        JOIN {{ source('imdb', 'roles') }} ON roles.actor_id = actors.id\n        LEFT OUTER JOIN {{ source('imdb', 'movies') }} ON movies.id = roles.movie_id\n)\nGROUP BY id\n\n{% if is_incremental() %}\n\n-- this filter will only be applied on an incremental run\nwhere id \u003e (select max(id) from {{ this }}) or updated_at \u003e (select max(updated_at) from {{this}})\n\n{% endif %}\n```\nWe can verify that view, table \u0026 incremental materializations, all generate the same response. \n```\n SELECT * FROM imdb.actors_insight_table ORDER BY num_movies DESC;\n```\n```commandline\ndbt run -m models/actors_insight_incremental.sql\n```\nLet's insert a few more rows to demonstrate the power of incremental materializations. Now the most \nappeared actor should be 'Chris Pratt'. \n```\nINSERT INTO imdb.movies VALUES (9, 'Passengers', 2016, 7);\nINSERT INTO imdb.movies VALUES (10, 'The Tomorrow War', 2021, 6.5);\n\nINSERT INTO imdb.roles (actor_id, movie_id, role_name) VALUES(4, 9, 'Jim Preston');\nINSERT INTO imdb.roles (actor_id, movie_id, role_name) VALUES(4, 10, 'Dan Forester');\n```\n```commandline\ndbt run -m models/actors_insight_incremental.sql\n```\n```\nSELECT * FROM imdb.actors_insight_incremental ORDER BY num_movies DESC;\n```\n![Confirm3](./examples/9_incremental_confirm.png)\n### How it works\n1. `dbt` will first create a temporary table named `actors_insight_incremental_tmp` \u0026 insert all those rows which \npass our `is_incremental()` filter.\n2. A new table `actors_insight_incremental_new` will be created \u0026 rows from the old table `actors_insight_incremental` \nwill be ingested here. `dbt` will make sure that `unique_key` (if any declared in config) constraint is maintained, \nby not allowing those rows which have the same `unique_key` as the previous temporary table. \n3. The rows from the temporary table would be ingested into the new table.\n4. Our previous table (`actors_insight_incremental`) \u0026 new table (`actors_insight_new`) will be exchanged. \n# Project Documentation\n`dbt` provides a way to generate documentation for your dbt project and render it as a website. \nCreate `models/actors_insight_incremental.yml` to generate documentation for our models. \n```yaml\nversion: 2\n\nmodels:\n  - name: actors_insight_incremental\n    description: Actor appearance summary based on roles\n    columns: \n      - name: id\n        description: The id number of actor\n      - name: name\n        description: The name of actor\n      - name: num_movies\n        description: The number of movies actor has appeared \n      - name: avg_rating\n        description: Average rating\n      - name: updated_at\n        description: Latest update time\n```\nUse `dbt docs generate` to generate the documentation for your models \u0026 `dbt docs serve` to serve the documentation in \nyour local browser on port 8000.\n![Doc](./examples/10_docs.png)\n# Local Development\nUpdate `tests/integration/confest.py` file to include your connection credentials. For running tests locally, follow \nthese steps:\n```commandline\npip install -r dev_requirements.txt\npython -m pytest\n```\n# Original Author\nByteHouse wants to thank ClickHouse for original contribution to this connector.\n\n# License\nThis project is distributed under the terms of the Apache License (Version 2.0).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytehouse-cloud%2Fbytehouse-dbt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytehouse-cloud%2Fbytehouse-dbt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytehouse-cloud%2Fbytehouse-dbt/lists"}