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

Column-level comments in views cause ERROR when config.persist_docs is enabled #80

Closed
marvin-froemming opened this issue Jun 14, 2023 · 1 comment

Comments

@marvin-froemming
Copy link

As per Exasol documentation, view comments can only be specified in the CREATE VIEW statement. (Source)

Unfortunately, this adapter currently tries to set the column comments outside of the CREATE VIEW statement by using COMMENT IS after the DDL. While this works for tables, it will raise an error for views. It only happens if you provide column descriptions for a model in the YAML file.

For example, the following statement is automatically generated by dbt and sent to Exasol if the columns are properly documented:

COMMENT ON view test_schema.test_view (
"test_col_1"  IS 'testtest',
"test_col_2"  IS 'testtest2'
)

Which will raise the following error:

syntax error, unexpected '(', expecting IS_ or IS_NULL_

According to my tests this only applies to column-level comments, model comments work properly.

Pretty sure that this macro just needs a check whether the relation is a view and if so, just omit the comments. But I haven't had time to fully understand whether comments are actually added twice (first in DDL and afterwards again). I'd be willing to submit a PR, but I have no prior experience contributing/testing a dbt adapter.

My setup:

I enabled the persist_docs config in dbt_project.yml:

models:
  +persist_docs:
    columns: true
    relations: true

Used dbt version: 1.4.6
Used Exasol version: 7.1+

@tglunde
Copy link
Owner

tglunde commented Jun 28, 2023

Hi @marvin-froemming ,

thank you very much for the detailed description and clear error statement.
It should be an easy fix as described by you already - I will look into it this week.
Please create a suggestion anyhow - even on a PR - I can join in and provide the testing efforts - or if you wish we could do it in pair.

Regards, Torsten

marvinfromblueforte added a commit to marvinfromblueforte/dbt-exasol that referenced this issue Jul 3, 2023
marvinfromblueforte added a commit to marvinfromblueforte/dbt-exasol that referenced this issue Jul 3, 2023
marvinfromblueforte added a commit to marvinfromblueforte/dbt-exasol that referenced this issue Jul 3, 2023
tglunde added a commit that referenced this issue Jul 13, 2023
* #80 disable comments on views outside DDL

* #80 relation comment

* #80 whitespace control

* added view test with persist docs enabled

---------

Co-authored-by: Torsten Glunde <torsten.glunde@alligator-company.com>
tglunde added a commit that referenced this issue Jul 13, 2023
* #80 disable comments on views outside DDL

* #80 relation comment

* #80 whitespace control

* added view test with persist docs enabled

---------

Co-authored-by: Torsten Glunde <torsten.glunde@alligator-company.com>
tglunde added a commit that referenced this issue Jul 13, 2023
* #80 disable comments on views outside DDL

* #80 relation comment

* #80 whitespace control

* added view test with persist docs enabled

---------

Co-authored-by: Torsten Glunde <torsten.glunde@alligator-company.com>
@tglunde tglunde closed this as completed Jul 28, 2023
peterkioko pushed a commit to GrantStreetGroup/dbt-exasol that referenced this issue Nov 10, 2023
* tglunde#80 disable comments on views outside DDL

* tglunde#80 relation comment

* tglunde#80 whitespace control

* added view test with persist docs enabled

---------

Co-authored-by: Torsten Glunde <torsten.glunde@alligator-company.com>
peterkioko pushed a commit to GrantStreetGroup/dbt-exasol that referenced this issue Nov 10, 2023
Merge in GITHUB/dbt-exasol from pull_in_upstream_changes to master

* commit '2f99f8e37333cb91df0f4700269e34fcfdb1febd':
  xdist for parallel pytest execution added - mv & clone miss in readme (tglunde#108)
  95 dbt16 tests  (tglunde#99)
  Bump urllib3 from 1.26.16 to 1.26.18 (tglunde#106)
  Bump cryptography from 41.0.3 to 41.0.4 (tglunde#100)
  caching fix, removed table macro overwrite (tglunde#103)
  full refresh behaviour fix (tglunde#107)
  adding debug test (tglunde#98)
  version bump 16 && limit simple test added (tglunde#96)
  bugfix null handling csv hash test - version upgrade 1.6 (tglunde#97)
  poetry update && re-added 4ec4415 for adding multiple cols in exasol (tglunde#93)
  v1.5 tests, incremental merge, temp table fix (tglunde#86)
  89 contract tests fail after dbt core update from 151 to 152 (tglunde#92)
  source freshness timestamp parsing fix (tglunde#91)
  v1.5 model contracts (tglunde#87)
  Bump sqlfluff from 2.1.1 to 2.1.2 (tglunde#83)
  tglunde#80 Disable view comments outside of DDL (tglunde#82)
  adding parameter for OpenID login with access/refresh token (tglunde#79)
  Bump requests from 2.29.0 to 2.31.0 (tglunde#76)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants