# SPACES in column names in model sql

**URL:** <https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134>\
**Category:** Help\
**Created:** [April 23, 2025, 8:46pm UTC](https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134 "2025-04-23T20:46:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajasaab](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rajasaab](https://discourse.getdbt.com/u/rajasaab)\
**Post date:** [April 23, 2025, 8:46pm UTC](https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134/1 "2025-04-23T20:46:02Z")

</div>

i am creating a sql model (databricks is the database) and the column names that i want to create have spaces in them (eg. First Name) . i am using backticks to wrap the column name but am getting the following error message when i run the model..

[DELTA\_INVALID\_CHARACTERS\_IN\_COLUMN\_NAMES] Found invalid character(s) among ’ ,;{}()\n\t=’ in the column names of your schema.  
Invalid column names: Job Code.  
Please use other characters and try again.  
Alternatively, enable Column Mapping to keep using these characters.  
compiled code at target/run/cndp\_warehouse/models/gold/interfaces/bettercomp/full/i\_bettercomp\_job.sql

here is my model SQL snippet..

select  
j.job\_code as `Job Code`  
, j.job\_name as `Job Title`

---

<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:** [April 24, 2025, 4:57am UTC](https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134/2 "2025-04-24T04:57:34Z")

</div>

In general it’s not a good idea to have spaces in column names. Keep to lower\_snake\_case to avoid a lot of future issues 😊

Note: `@Jeremy Yeo` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CBSQTAPLG/p1745470645521639?thread_ts=1745441195.027829&cid=CBSQTAPLG). It might not have transferred perfectly.

---

<div class="post-metadata">

**Author:** ![DataNath](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/datanath/32/4070_2.png) [@DataNath](https://discourse.getdbt.com/u/DataNath)\
**Post date:** [April 25, 2025, 1:52am UTC](https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134/3 "2025-04-25T01:52:13Z")

</div>

This is also just disallowed when persisting objects in Databricks’ Unity Catalog. Here’s some documentation on what they suggest/forbidden chars, which includes spaces: [Names | Databricks Documentation](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names)

---

<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:** [May 21, 2025, 6:39pm UTC](https://discourse.getdbt.com/t/spaces-in-column-names-in-model-sql/19134/4 "2025-05-21T18:39:24Z")

</div>

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