-
-
Notifications
You must be signed in to change notification settings - Fork 873
Allow arbitrary attributes & methods for ThisEmulator
#6254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also changed the return of Sample resultst = ThisEmulator("ref_model")
print(t)
print(t.database)
print(t.schema)
print(t.name)
print(t.identifier)
print(t.type)
print(t.something_new)
print(t.is_table)
print(t.is_view)
print(t.is_materialized_view)
print(t.is_cte)
print(t.is_dynamic_table)
print(t.is_iceberg_format)
print(t.include())
print(t.include(database=False))
print(t.some_new_method()) Prints:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! I like the approach. Will review properly once I've seen what it does to the test suite, but on a first pass I think this looks like a good approach.
@alanmcruickshank: I fixed a few things! The next test run should work better. 🤞 |
Ah crap.... |
In order to support older versions of Python.
@alanmcruickshank: Fixed! |
Thanks for the quick fix! 🙌 Not sure why it can't find |
Coverage Results ✅
|
Ah, duh.... it's not just a dev dependency. 🤦♂️ |
@alanmcruickshank: Just added |
I'm not sure you should need to add |
@mroy-seedbox I think the last outstanding thing is some test cases, I think some of the samples you posted above would be great 👍 |
In order to support the optional `version` parameter
Through `dbt_builtins`
@alanmcruickshank: Tests are ready! |
@alanmcruickshank: Just need to run the test coverage on the latest commit, and it should pass! 👌 |
Actually, just checking this now, and there's a little improvement that could be made to conform better to how DBT Relations work! Won't take long! |
The full test suite is still running on my end, but everything is looking good so far! |
@alanmcruickshank: Alright, all good on my end! ✅ Although I can't get the coverage report to complete. It says "No data to combine". 🤷♂️ Apologies for my laziness & lack of time/effort/thoroughness earlier in this process. 😞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Looks great. Thanks for contributing this 👍
Brief summary of the change made
{{ this.identifier }}
in DBT (but with the Jinja templater).ThisEmulator
toRelationEmulator
.ref()
andsource()
as well.this.identifier
#6253Are there any other side effects of this change that we should be aware of?
No. Identical as before, but supports more possibilities.
Sample results
Prints:
Alternative Solutions
Initially, I tried this:
But then that broke
{{ this }}
. 🤦♂️ So not a solution.Then I tried this:
Which simply does not work at all. 😞 But... it would be pretty awesome if it did work! It would give us a lot more flexibility to customize things (in order to override only specific parts of objects, like
this.*
,target.*
, and others).