Skip to content

Making the dbt-devnull adapter flexible for more DB types #2

@jice-lavocat

Description

@jice-lavocat

Currently DevNullAdapter inherits from SQLAdapter.

This introduces several specific behaviors that will lead to unexpected parsing effects when using linters such as SQLFluff.
For instance, the {{ source(a,b) }} or {{ ref(a) }} method use some specific quotes in BigQuery (instead of " it should be using `).
This results in SQLFuff returning failures similar to Found unparsable section: ...

--

One solution I've been using, but which requires having a fork was to change the impl.py file from

from dbt.adapters.sql import SQLAdapter
from dbt.adapters.devnull import DevNullConnectionManager
from dbt.adapters.base.relation import BaseRelation

class DevNullAdapter(SQLAdapter):
    ConnectionManager = DevNullConnectionManager
...

to

from dbt.adapters.bigquery import BigQueryAdapter
from dbt.adapters.devnull import DevNullConnectionManager
from dbt.adapters.base.relation import BaseRelation

class DevNullAdapter(BigQueryAdapter):
    ConnectionManager = DevNullConnectionManager
...

I'm pretty sure that there could be a better way to make the devnull adapter more flexible but I'm not a dev guy, so I can't really suggest better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions