Tomme / dbt-athena

The athena adapter plugin for dbt (https://getdbt.com)
Apache License 2.0
142 stars 79 forks source link

Add example of source quoting to README.md #16

Closed stumelius closed 3 years ago

stumelius commented 3 years ago

@Tomme as discussed previously, I took a look at the quoting issue and probably arrived at the same conclusion as you when you initially decided not to spend time on it. Here's the gist as I understand it:

In order for the adapter to support quoting it would have to be able to distinguish between DDL and DML statements and then pass that information on to the methods that handle quoting (e.g., AthenaRelation.quoted, AthenaAdapter.quote). This in turn requires overloading of the quoting methods which is simple enough but we'd also need to overload quite a lot of existing macros that call these methods. It might be worth the initial effort but maintaining the overloaded macros could turn into a nightmare.

Instead of fixing the quoting issue I added an example source quoting in README.md.

Examples

Hive DDL:

create external table if not exists `"user 123"` (
    id int,
    name varchar(255)
)
location 's3://athena-query-results/user/'

Presto DML:

insert into "user 123" (id, name)
values (1, 'test user')