dbt-msft / tsql-utils

dbt-utils for the dbt-msft family of packages
MIT License
25 stars 25 forks source link

Add CI #5

Closed dataders closed 3 years ago

dataders commented 3 years ago

To Do:

jtcohen6 commented 3 years ago

Looks like the CI failures have to do with the dbt seed step. These are tricky:

It's possible that we'll need to:

dataders commented 3 years ago
  • Cannot find data type 'timestamp'.

  • Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.

  • A table can only have one timestamp column. Because table 'data_dateadd' already has one, the column 'result' cannot be added.

yeah these definitely seem T-SQL specific. I'll ask @NandanHegde15 to take a look at those errors. I agree we might have to make different versions of the csvs if we can't fix it adapter-side.

meanwhile, is there a way to disable that set of seeds so we can get some feedback on which macros work and which don't?

jtcohen6 commented 3 years ago

meanwhile, is there a way to disable that set of seeds so we can get some feedback on which macros work and which don't?

based on the seeds that are currently failing, I think you can update what's here to be:

seeds:
  dbt_utils_integration_tests:
    cross_db:
      data_date_trunc:
        +enabled: false
      data_dateadd:
        +enabled: false
      data_datediff:
        +enabled: false
      data_last_day:
        +enabled: false
    etc:
      data_people:
        +enabled: false
    sql:
      data_get_query_results_as_dict:
        +enabled: false
      data_safe_add:
        +enabled: false
    schema_tests:
      data_test_mutually_exclusive_ranges_with_gaps:
        +enabled: false
      data_test_not_null_where:
        +enabled: false

models:
  dbt_utils_integration_tests:
    cross_db_utils:
      +enabled: true
      test_date_trunc:
        +enabled: false
      test_dateadd:
        +enabled: false
      test_datediff:
        +enabled: false
      test_last_day:
        +enabled: false
    datetime:
      +enabled: true
    materializations:
      +enabled: false
    schema_tests:
      +enabled: false
    sql:
      +enabled: true
      test_safe_add:
        +enabled: false
    web:
      +enabled: false
dataders commented 3 years ago

The issue I'm seeing now is that in T-SQL, the type timestamp is really datetime (timestamp is a special thing in T-SQL that's mostly deprecated now). So if I want to change the column types in dbt-utils's 'integration_tests/dbt_project.yml` how might one do that?

seeds:

  +quote_columns: false
  dbt_utils_integration_tests:

    cross_db:
      data_date_trunc:
        +column_types:
          updated_at: timestamp
          day: date
          month: date

      data_dateadd:
        +column_types:
          from_time: timestamp
          result: timestamp

      data_datediff:
        +column_types:
          first_date: timestamp
          second_date: timestamp
jtcohen6 commented 3 years ago

the way you just did it is what I was going to recommend :)

dataders commented 3 years ago

ok now we're getting juicy, actionable information! thanks @jtcohen6! @alittlesliceoftom here's the short list of the 16 dbt-utils macros that need TLC (T-SQL loving care) and re-implemented here in this shim package.

Incorrect syntax near...