diff --git a/dbtmetabase/_models.py b/dbtmetabase/_models.py index 189124b..ba217df 100644 --- a/dbtmetabase/_models.py +++ b/dbtmetabase/_models.py @@ -209,6 +209,7 @@ def __export_column( table_key = f"{schema_name}.{model_name}" column_name = column.name.upper() + column_label = f"{schema_name}.{model_name}.{column_name}" api_field = ctx.tables.get(table_key, {}).get("fields", {}).get(column_name) if not api_field: @@ -231,7 +232,6 @@ def __export_column( column.fk_target_field.upper() if column.fk_target_field else None ) fk_target_field_label = f"{fk_target_table_name}.{fk_target_field_name}" - column_label = f"{table_key}.{column_name}" if fk_target_table_name and fk_target_field_name: fk_target_field = ( @@ -240,6 +240,7 @@ def __export_column( .get(fk_target_field_name) ) if fk_target_field: + fk_target_field_id = fk_target_field.get("id") if fk_target_field.get(semantic_type_key) != "type/PK": _logger.info( "Field '%s' will be updated as primary key for foreign key '%s'", @@ -315,7 +316,6 @@ def __export_column( ): body_field[semantic_type_key] = column.semantic_type or None - column_label = f"{schema_name}.{model_name}.{column_name}" if body_field: ctx.update(entity=api_field, change=body_field, label=column_label) _logger.info( diff --git a/tests/test_format.py b/tests/test_format.py index 61ccd1c..823139d 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -30,6 +30,7 @@ def test_filter(self): def test_null_value(self): self.assertIsNotNone(NullValue) self.assertFalse(NullValue) + self.assertIs(NullValue, NullValue) def test_safe_name(self): self.assertEqual(