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

Add options clause to create table macro #171

Merged

Conversation

JCZuurmond
Copy link
Collaborator

@JCZuurmond JCZuurmond commented May 28, 2021

resolves #147

Description

Adds an option clause macro which allows for adding options to a table via the config:

{{
  config(
    materialized='table',
    file_format='jdbc',
    options={
      'dbtable': 'my_table',
      'url': 'jdbc:sqlserver://${spark.serverName}:1433;databaseName=database;',
      'user': '${spark.adminUsername}',
      'password': '${spark.adminPassword}'
    }
  )
}}

Heavily inspired on #148. @friendofasquid : I went ahead, implemented a solution based on the examples you created, here to contribute back.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label May 28, 2021
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all about it! Thanks @JCZuurmond, this looks great.

My only ask: Could you add options to the SparkConfig class here? That's where we track adapter-specific configs that can be set in dbt_project.yml, be recorded in manifest.json, and may or may not want custom validation.

@JCZuurmond
Copy link
Collaborator Author

Done!

Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @JCZuurmond!

@jtcohen6 jtcohen6 merged commit c13f1dd into dbt-labs:master Jun 2, 2021
@JCZuurmond JCZuurmond deleted the add-options-clause-to-create-table-macro branch September 8, 2021 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support setting table OPTIONS using config
2 participants