Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape column names with special characters when persisting descriptions as comments #427

Open
erik-amundson-anthro opened this issue Feb 21, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@erik-amundson-anthro
Copy link

Is your feature request related to a problem? Please describe.

I would like to be able to persist my DBT column descriptions as column comments, but for column with special characters the connector fails with persist_docs.columns = true in the project configuration.

For example, this model:

  - name: cell_recipe
    description: Cell recipe information
    columns:
      - name: "standing_vacuum_pressure_1 (kPa)"
        description: Standing vacuum 1 pressure
        data_type: float64
        quote: true
      - name: "standing_vacuum_time_1 (s)"
        description: Standing vacuum 1 time under vacuum
        data_type: int64
        quote: true

creates this query

alter table `common`.`cell_recipe` modify comment ?, comment column standing_vacuum_pressure_1 (kPa) ?, comment column standing_vacuum_time_1 (s) ?

Interestingly, the table name is automatically escaped.

Describe the solution you'd like

I would like to be able to auto-populate column comments using the dbt persist_docs feature.

Describe alternatives you've considered

I've tried the following:

  • Adding quote: true to the column specifications (no effect)
  • Adding double quotes to escape the column name manually (no effect)
  • Adding backticks to escape the column name (causes error)

I could also potentially write my own comment generation as a post-hook but it would be a lot of work to duplicate all the descriptions and keep them up to date.

@erik-amundson-anthro erik-amundson-anthro added the enhancement New feature or request label Feb 21, 2025
@erik-amundson-anthro
Copy link
Author

I can probably contribute this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant