# Rename an existing table

**URL:** <https://discourse.getdbt.com/t/rename-an-existing-table/6330>\
**Category:** Help\
**Tags:** best-practice, bigquery\
**Created:** [January 25, 2023, 3:03am UTC](https://discourse.getdbt.com/t/rename-an-existing-table/6330 "2023-01-25T03:03:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenleo](https://avatars.discourse-cdn.com/v4/letter/s/4491bb/32.png) [@stephenleo](https://discourse.getdbt.com/u/stephenleo)\
**Post date:** [January 25, 2023, 3:03am UTC](https://discourse.getdbt.com/t/rename-an-existing-table/6330/1 "2023-01-25T03:03:51Z")

</div>

## The problem I’m having

I have an existing model materialized as a table on Big Query. The table name is `daily-events_DATE`

I would like to rename this table to `daily_events_DATE` without losing any of the data in the table. (Replace the hyphen with underscore)

Is this possible?

## The context of why I’m trying to do this

Big Query’s UI doesn’t display date-sharded tables correctly if there’s a `-` (hyphen) in the table name and only supports `_` (underscore)

## What I’ve already tried

Google searching but I’m quite new to dbt and didn’t find any straightforward answers to the question. [when rebuilding tables, dbt should use table renaming to minimize amount of time the table is unavailable · Issue #68 · dbt-labs/dbt-core · GitHub](https://github.com/dbt-labs/dbt-core/issues/68) seems to suggest renaming will drop the table and all old data will be lost.

---

<div class="post-metadata">

**Author:** ![a\_slack\_user](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/a_slack_user/32/1629_2.png) [@a\_slack\_user](https://discourse.getdbt.com/u/a_slack_user)\
**Post date:** [January 25, 2023, 3:06am UTC](https://discourse.getdbt.com/t/rename-an-existing-table/6330/2 "2023-01-25T03:06:09Z")

</div>

Generally the process you’ll need is:

1. Rename the model in dbt
2. Manually rename the table in BQ

Note: `@Josh Devlin (he)` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CBSQTAPLG/p1674615961695599?thread_ts=1674615855.620139&cid=CBSQTAPLG). It might not have transferred perfectly.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/a7a7ca1fe379aaf90952b0e13118a817babcd14f.png) [@system](https://discourse.getdbt.com/u/system)\
**Post date:** [February 1, 2023, 10:32pm UTC](https://discourse.getdbt.com/t/rename-an-existing-table/6330/3 "2023-02-01T22:32:15Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
