Skip to content

generate_source doesn't work in analysis tab in fusion #265

@will-sargent-dbtlabs

Description

@will-sargent-dbtlabs

Describe the bug

I set up the basic analysis sheet in a fusion project to generate_source like this:
{{ codegen.generate_source(schema_name= 'dbt_artifacts', database_name= 'copilot_converters') }}

NOTE: Running this as a run-operation works OK.

And Instead of being able to compile, i get this:

dbt1501: Failed to render SQL unknown function: In dispatch: No macro named 'generate_source' found within namespace: 'codegen'
    Searched for: 'my_new_project.snowflake__generate_source', 'my_new_project.snowflake__generate_source', 'my_new_project.default__generate_source', 'my_new_project.default__generate_source', 'my_new_project.generate_source', 'my_new_project.generate_source'
(in analyses/sources_work.sql:1:1)
(in dbt_packages/codegen/macros/generate_source.sql:17:31)
  --> analyses/sources_work.sql:1:1

Structured logs

[{
	"resource": "/analyses/sources_work.sql",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "1501",
	"severity": 8,
	"message": "dbt1501: Failed to render SQL unknown function: In dispatch: No macro named 'generate_source' found within namespace: 'codegen'\n    Searched for: 'my_new_project.snowflake__generate_source', 'my_new_project.snowflake__generate_source', 'my_new_project.default__generate_source', 'my_new_project.default__generate_source', 'my_new_project.generate_source', 'my_new_project.generate_source'\n(in analyses/sources_work.sql:1:1)\n(in dbt_packages/codegen/macros/generate_source.sql:17:31)\n  --> analyses/sources_work.sql:1:1",
	"source": "dbt",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 2,
	"endColumn": 1,
	"origin": "extHost1"
}]

Steps to reproduce

Expected results

Actual results

select distinct
            table_schema as "table_schema",
            table_name as "table_name",
            
            case table_type
                when 'BASE TABLE' then 'table'
                when 'EXTERNAL TABLE' then 'external'
                when 'MATERIALIZED VIEW' then 'materializedview'
                else lower(table_type)
            end as "table_type"

        from copilot_converters.information_schema.tables
        where table_schema ilike 'dbt_artifacts'
        and table_name ilike '%'
        and table_name not ilike ''
/* {"app": "dbt", "connection_name": "", "dbt_version": "2.0.0", "profile_name": "user", "target_name": "dev"} */

Screenshots and log output

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/codegen
    version: 0.14.0

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

17:05:32 Cloud CLI invocation created: a4552264-ffa1-42be-ae39-a78da8f15ba3
17:05:33 dbt-fusion 2.0.0-preview.92

The operating system you're using:
Mac. In dbt platform studio.

The output of python --version:

Additional context

Are you interested in contributing the fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions