kristeligt-dagblad / dbt_ml

Package for dbt that allows users to train, audit and use BigQuery ML models.
Apache License 2.0
64 stars 26 forks source link

'Tuple Object' has no attribute 'startswith' #38

Closed CraigWilson-ZOE closed 1 year ago

CraigWilson-ZOE commented 2 years ago

Overview

When running a k-means clustering model in BigQuery I am getting the following error message:

12:45:09  Completed with 1 error and 0 warnings:
12:45:09  
12:45:09  Compilation Error in macro model_options (macros/materializations/model.sql)
12:45:09    'tuple object' has no attribute 'startswith'
12:45:09    
12:45:09    > in macro bigquery__create_model_as (macros/materializations/model.sql)
12:45:09    > called by macro create_model_as (macros/materializations/model.sql)
12:45:09    > called by macro statement (macros/etc/statement.sql)
12:45:09    > called by macro materialization_model_bigquery (macros/materializations/model.sql)
12:45:10    > called by macro model_options (macros/materializations/model.sql)

The code is similar to the following:

{{
    config(
        materialized='model',
        ml_config={
            'model_type': 'kmeans',
            'num_clusters': 3
        }
    )
}}

SELECT
   userid,
   average_number_clicks
FROM
   {{ ref('stg_user_clicks') }}
GROUP BY 1

Fix

I managed to get this working locally by changing the code in the macros/materializations/model.sql file, and will submit a PR with the fix included.

rbjerrum commented 1 year ago

This is corrected in latest version.