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

0.13.1 Runtime Error when Snowflake Destination Schema contains External Table #1505

Closed
Swibles opened this issue Jun 5, 2019 · 6 comments
Closed

Comments

@Swibles
Copy link

Swibles commented Jun 5, 2019

Issue

0.13.1 Runtime Error when Snowflake Destination Schema contains External Table

Issue description

Running dbt run --model MODEL_NAME fails

Results

Runtime error is thrown:
Running with dbt=0.13.1
Found 23 models, 413 tests, 0 archives, 0 analyses, 210 macros, 9 operations, 1 seed files, 0 sources

Encountered an error:
Runtime Error
Invalid arguments passed to "SnowflakeRelation" instance: type.'EXTERNAL TABLE' is not one of ['table', 'view', 'cte', 'materializedview', None]

System information

The output of dbt --version:

installed version: 0.13.1
   latest version: 0.13.1

The operating system you're running on:
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.17134 N/A Build 17134
The python version you're using (probably the output of python --version)
Python 3.7.3

Steps to reproduce

  1. Create an external table in a Snowflake database schema that dbt manages.
  2. Run dbt run on any model, even a model that is in a different schema of the same database.

Proposed Solution

Found a similar issue for Materialized Views here: #1430

Following similar steps, added the following external table lines to response.py:

class BaseRelation(APIObject):

    Table = "table"
    View = "view"
    CTE = "cte"
    MaterializedView = "materializedview"
    ExternalTable = "EXTERNAL TABLE"

    RelationTypes = [
        Table,
        View,
        CTE,
        MaterializedView,
        ExternalTable
    ]

This fixes the error for local installation, but dbt cloud runs still fail.

@krishbox
Copy link

We have the same issue and will local fix it to move forward. Can we create a PR for this?

@drewbanin
Copy link
Contributor

Hey @krishbox - sure, we'd love a PR for this! Feel free to open one up and we can take it from there

@krishbox
Copy link

Hello @drewbanin, is there anything in the way of permissions needed for contributing. The reason I ask is because:

~/Development/dbt/dbt (krishbox-snowflake-externaltable)
$ git status
On branch krishbox-snowflake-externaltable
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   core/dbt/adapters/base/relation.py
	modified:   plugins/snowflake/dbt/include/snowflake/macros/adapters.sql

no changes added to commit (use "git add" and/or "git commit -a")
~/Development/dbt/dbt (krishbox-snowflake-externaltable)
$ git add .
~/Development/dbt/dbt (krishbox-snowflake-externaltable)
$ git commit -m "Add ExternalTable relation type, update Snowflake adapter #1505"
[krishbox-snowflake-externaltable 56a08d7a] Add ExternalTable relation type, update Snowflake adapter #1505
 2 files changed, 4 insertions(+), 1 deletion(-)
~/Development/dbt/dbt (krishbox-snowflake-externaltable)
$ gp
ERROR: Permission to fishtown-analytics/dbt.git denied to krishbox.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
~/Development/dbt/dbt (krishbox-snowflake-externaltable)

@drewbanin
Copy link
Contributor

You're going to want to fork this repo into your personal github account (or your org's), then push to a branch of the repo you control. Once you do that, you should be able to open up a Pull Request across the repositories.

The big idea is that GitHub doesn't give people arbitrary push access to other org's repos. You just need to push to a repo you own, then you can open up the PR. Hope this helps!

@josegalarza
Copy link
Contributor

Hi @drewbanin, thanks for your quick responses! We just PR'd the change. 🤞

drewbanin added a commit that referenced this issue Jun 26, 2019
Add ExternalTable relation type, update Snowflake adapter (issue #1505)
@beckjake
Copy link
Contributor

Fixed by #1571

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

5 participants