Elementary bug with Custom Test / Singular test. ...
# community-support
c
Elementary bug with Custom Test / Singular test. Hi, we have a singular test that looks like this:
Copy code
{{ config(meta = {
    'owner': 'Company Domain Name'
}) }}

<test query>
Within the elementary report, these singular tests are not connected to the shared domain team responsible for it. So when we click "Test Results->Filter->Owner" and select our domain team the test doesn't appear, neither does any singular test connected to our domain. All other tests that are generic work fine. When inspecting the test in the manifest.json I can clearly see that the meta data is set. Could it be that the filtering option in Elementary is not including Singular tests? We can spot them otherwise in the report.
d
Hey @Christopher Ekfeldt, The owner property is attached to a model, and not to a test as you're trying to do, so your singular test is not related to the model and to its owner as well. That being said, you can add to the top of your singular test file a
depends_on
expression, which will relate the test and the model -
Copy code
-- depends_on: {{ ref('<model>') }}

<test query>
and if "model" contains an owner, the singular test will be related to the model's owner.
👍 1
c
So even though the documentation states that meta can be set to singular tests, the owner meta config is not attachable? Thanks for the tip with using the depends_on. I will have a look at it.
d
The
meta
can be set, but currently the report allows filtering only by model's owner, and not for test's owner, therefore you should associate the test with some model.
c
We did the change of using --depends on, but then removed the config block in the singular test sql. Now the result still fails and but looks like this:
d
@Christopher Ekfeldt If you filter by owner you should see it where you marked, and the singular test below. It's still not working ?
c
Nope, It is still not working, even though in the elementary dataset the tag is there but not the report GUI.
o
Hi @Christopher Ekfeldt. Does the model that this singular test relate to have the
owner
property set?
c
I did in my initial post you see the config block where we set the owner property.
o
Im not sure what you mean by the "initial post", but in the root message of this thread it looks like a config block for a singular test
c
Oh I'm sorry, I didn't fully understand what you meant. Yes the underlying model the test refers to holds the metadata propetry "owner".
o
Can you share the full code of the test? privately is ok if you prefer
👍 1
c
So do we have a solution here? Neither -- depends on or config block in the singular test gets the metadata shown in the Elementary Report.
Does something look odd or off? Should I remove depends on and just keep config block or vice versa?
o
Hi @Christopher Ekfeldt, so after some digging we figured it out. the issue originates from the fact that the test depends on two models. In elementary, there is a strong link between a test and a model, and we depend on the fact that a test is associated with one model. For that reason, we dont really know what to do with a test that is associated with more than one model (eg - a singular test on two models) We do have plans to address this in the near future, but in the meantime they are not supported for owner, tagging etc... drop corrupt
👍 1
c
Okay, thanks for the response. For those test that only depend on 1 model, should --depends on be used or the config block within the .sql file?
o
For tests that depend on one model,
--depends-on
should work
e
I know this is an old thread, but I want to boost this feature request again. We have a number of singular tests that query multiple models (this is one of the main use cases for singular tests from my perspective), and setting the owner does not cause the test to be filed under the specified owner in the Elementary dashboard. This makes it quite difficult for the test owner to find their singular tests. https://elementary-community.slack.com/archives/C08HW57FGN9/p1748893804915899?thread_ts=1748893675.799129&amp;cid=C08HW57FGN9
j
➕ to Eli's message