dbt-labs / dbt-adapter-tests

a pytest plugin for dbt adapter test suites
19 stars 11 forks source link

Is there a way to change column type: #40

Open hua0129 opened 2 years ago

hua0129 commented 2 years ago

This is the ddl of "Create table" when testing squence base: create table dbt_test_220616055423285597304654.base ("id" integer,"name" text,"some_date" timestamp)

   create table dbt_test_220616070911922739318488.base ("id" integer,"name" text,"some_date" timestamp) 
ERROR 42X94: TYPE 'TEXT' does not exist.     

The type of name is text, how to change this type into varchar? thanks.

jtcohen6 commented 2 years ago

Hey @hua0129, it sounds like you want to reimplement the convert_text_type method in your adapter plugin. That's what dbt uses when loading CSV files (dbt seed), and translating inferred types into database types. By default (for "SQL" adapters), it returns text, and you want it to return varchar.

One thing worth noting: We've developed a new testing suite to replace the one in this repository. For documentation and details: https://docs.getdbt.com/docs/contributing/testing-a-new-adapter

hua0129 commented 2 years ago

Fixed. Thanks. @jtcohen6