Incorrect wrap of long text comment for Databricks DDL using Spark SQL Dialect

已回答

We define comments on our Databricks DDL files. For long descriptions, hitting the return key to wrap within a single quoted string is injecting the wrong line wrapping characters for Databricks. I haven't found a way to alter this behavior. 

When wrapping long text in Databricks DDL  using the Spark SQL dialect, as in comments

  • Expected: 
    • Hitting return should insert \\n and align the wrapped text
  • Actual:
    • Hitting return inserts ‘ ||\n’ , which is illegal syntax for Databricks but OK for Postgres

Example: 

CREATE TABLE IF NOT EXISTS my_table (
    site_id                  BIGINT PRIMARY KEY,
    site_name                STRING
        COMMENT 'The name of the care_site as it appears in the source data',
    place_of_service_id      BIGINT
        COMMENT 'This is a high-level way of characterizing a Site. Typically, however, Sites can provide ' ||
        'care in multiple settings (inpatient, outpatient, etc.) and this granularity' ||
        ' should be reflected in the visit.',
    load_dt                    DATE
    ) USING DELTA TBLPROPERTIES (
        ...); 
0
There is a related issue:
https://youtrack.jetbrains.com/issue/DBE-7716/DataGrip-incorrectly-inserts-concatenation-operator-into-strings-when-creating-DB-comments

As a workaround, please disable Settings(Preferences) -> Editor -> Smart Keys -> SQL -> Insert string concatenation on Enter.
0

请先登录再写评论。