Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Specify schema for duplicate table dependencies.

Hello, apologies for any error, this is my first question.

I have a table table_overview with a dependency to table_tickets. Now table_tickets is present in two different schema so we essentially have service_one.table_tickets and service_two.table_tickets.

Hence I get the error:

Ambiguous Action name: {"name":"table_tickets","includeDependentAssertions":false}. Did you mean one of: service_one.table_tickets, service_two.table_tickets.

I tried adding the dependency with the following combinations but none of them worked:

  1. "table_tickets"
  2. "service_one.table_tickets"
  3. "sources.services_one.table_tickets" (because that is the folder structure to refer to the table)

Thanks in advance.

Solved Solved
2 7 389
2 ACCEPTED SOLUTIONS

Hi @DasOfChrist,

Welcome to Google Cloud Community!

You're encountering this error because Dataform needs a clear and unambiguous way to identify which table_tickets you're referring to. Since you have two tables with the same name in different schemas, you need to specify the full path to the table.

To fix this, use the ref function within your SQL query to explicitly reference the tables you need. This ensures Dataform correctly identifies the dependencies. Here’s a sample:

config { 
  type: "table", 
  schema: "adp", 
  name: "overview", 
  description: "Query loading data...", 
  tags: ["daily", "looker"], 
  dependencies: ["transactions"], 
  columns: { locations: "...", }, 
}

-- Rest of the SQL

SELECT ...
FROM ${ref("service_one", "table_tickets")}
UNION ALL
SELECT ...
FROM ${ref("service_two", "table_tickets")}

You can also consider some important considerations:

  • Folder Structure: The folder structure in your Dataform project doesn't directly influence how dependencies are resolved. Dataform relies on the schema and table names within the SQLX files.
  • Data Consistency: If you're using both service_one.table_tickets and service_two.table_tickets in your overview table, ensure that the data structure and relevant columns are compatible for the UNION operation.

I hope the above information is helpful.

View solution in original post

@DasOfChrist You're right, explicitly listing dependencies in the config block would enhance readability and make the table easier to maintain. It offers a high-level overview of relationships, which is especially useful for onboarding new developers or debugging.

Although the ref() function ensures dependencies are correctly resolved, explicitly documenting them in the config section would make dependencies more transparent. This could prevent confusion and align with best practices for collaborative development.

Since this would be more of a usability enhancement than a bug fix, I recommend submitting a feature request through the Dataform issue tracker. While I can’t guarantee a timeline for implementation, this is a great idea for improving developer experience. You can stay updated on progress via the issue tracker or Dataform release notes.

View solution in original post

7 REPLIES 7