codeforkjeff / dbt-sqlite

A SQLite adapter plugin for dbt (data build tool)
Apache License 2.0
78 stars 13 forks source link

Adapter-specific profile template #4

Closed dbeatty10 closed 4 years ago

dbeatty10 commented 4 years ago

Overview

Starting in dbt v0.18.0, the dbt init allows an optional --adapter. If you do, dbt will create ~/.dbt/profiles.yml (if one does not already exist) in accordance with the intended adapter type.

The dbt documentation includes a note for plugin authors that the --adapter flag looks for a file named dbt/include/[adapter_name]/sample_profiles.yml. The provided examples are dbt-spark and dbt-presto.

This pull request adds that file.

Testing

2 cases were tested:

  1. ~/.dbt/profiles.yml does not already exist
  2. ~/.dbt/profiles.yml already exists

In the former case, a new ~/.dbt/profiles.yml file is created, and it contains the template from dbt/include/sqlite/sample_profiles.yml.

In the latter case, the sample_profiles.yml file is ignored and it is completely up to the user to add the relevant configuration (as directed in the README).

codeforkjeff commented 4 years ago

This is great! I had no idea about the sample_profiles.yml file.

The spark adapter and others use bracket placeholder strings in its file: https://github.com/fishtown-analytics/dbt-spark/blob/master/dbt/include/spark/sample_profiles.yml

I am thinking we should follow the same convention. Plus, while it's convenient to have the verbose comments in that file, it duplicates what's in the README so edits would have to happen in both places. I've rather the README be the single place for documentation, and the sample_profiles.yml stay bare.

Could you make these changes to this branch?

dbeatty10 commented 4 years ago

This is great! I had no idea about the sample_profiles.yml file.

The spark adapter and others use bracket placeholder strings in its file: https://github.com/fishtown-analytics/dbt-spark/blob/master/dbt/include/spark/sample_profiles.yml

I am thinking we should follow the same convention. Plus, while it's convenient to have the verbose comments in that file, it duplicates what's in the README so edits would have to happen in both places. I've rather the README be the single place for documentation, and the sample_profiles.yml stay bare.

Could you make these changes to this branch?

Thanks for the great feedback. I made the following updates: