Dhawal Jain
03/20/2025, 9:20 AMkapa.ai
03/20/2025, 9:20 AMkapa.ai
03/20/2025, 9:20 AMmodel argument to be a relation type (database object), but in some cases it's being converted to a string. This happens particularly when there's a custom implementation of macros like get_where_subquery in your dbt project. From the knowledge sources, there are a few potential solutions: 1. If you're using a custom get_where_subquery macro, this might be causing the issue as noted in [this community discussion](https://slack.com/archives/C02CTC89LAX/p1657009818301009). Elementary tests might not work properly with custom implementations that return strings instead of relations. 2. For singular tests, you can use the override_primary_test_model_id config parameter to specify which model the test is associated with, as mentioned in [the Elementary documentation](https://docs.elementary-data.com/cloud/guides/troubleshoot#how-do-i-set-up-the-table-name-of-my-singular-test%3F). 3. If you're using custom schema/alias naming through overridden macros like generate_alias_name or generate_schema_name, you might need to modify these macros to handle Elementary models differently, as suggested in [this community thread](https://slack.com/archives/C02CTC89LAX/p1669049623458239). The most direct workaround would be to modify your custom macros to handle Elementary tests differently, or to use dbt.load_relation() instead of directly referencing the model in your test. If you could share more details about your specific implementation, I might be able to provide more targeted advice based on the knowledge sources. I'm here to help you troubleshoot this issue with Elementary Data!