# I would like to contribute a feature for SQL templating

**URL:** <https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227>\
**Category:** Contributing\
**Created:** [June 19, 2025, 2:52pm UTC](https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227 "2025-06-19T14:52:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![VovaVili](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/vovavili/32/380_2.png) [@VovaVili](https://discourse.greatexpectations.io/u/VovaVili)\
**Post date:** [June 19, 2025, 2:52pm UTC](https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227/1 "2025-06-19T14:52:48Z")

</div>

Hello all, this is me, Vladimir. I’ve had this post hanging in Slack for ± 20 days with no response, so I am cross posting it here, in hopes that it will get attention.

Quite frequently in my data engineering work, I run into a scenario where I need to write a customized SQL check where SQL code references a variable column name. In the official documentation, such scenarios are unforeseen, as the [quickstart only references the](https://docs.greatexpectations.io/docs/core/customize_expectations/use_sql_to_define_a_custom_expectation/)`{batch}` [template](https://docs.greatexpectations.io/docs/core/customize_expectations/use_sql_to_define_a_custom_expectation/). Therefore, I wrote my own abstract base class for scenarios like these, on the basis of a brief overlook of some cases in the experimental folder in GX Core source code:

> <https://gist.github.com/vovavili/ce44b9e561aee8778ccfc205f1e2b9f6>

I would really like to upstream this code, as no doubt such a scenario is something other people would run into all the time. However, I am not sure where to start. Would I need to make some changes to my already existing code? Would you like me to write official documentation for it as well? Where exactly would this bit of code belong in your code structure? I am more than willing to do everything required here. Please let me know what the next steps for me are to take before I submit a pull request.

---

<div class="post-metadata">

**Author:** ![joshstauffer](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@joshstauffer](https://discourse.greatexpectations.io/u/joshstauffer)\
**Post date:** [June 30, 2025, 9:08am UTC](https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227/2 "2025-06-30T09:08:07Z")

</div>

Hey @VovaVili, thanks for reaching out. We would be happy to accept a PR for this Expectation. I took a quick look at the gist you put together, and here’s some early feedback:

- This Expectation should live in `contrib/experimental/great_expectations_experimental/expectations`
- I would suggest using the `UnexpectedRowsExpectation` as a base class rather than the `QueryExpectation`. We’ve removed `QueryExpectation` from our docs, and the `UnexpectedRowsExpectation` is the preferred way to make tests from arbitrary SQL in GX v1.
- Add test coverage in `/tests/integration/contrib` using the `parametrize_batch_for_data_sources` pattern. As an example, see any test module in the `tests/integration/data_sources_and_expectations/expectations` package.

We won’t have capacity to help out with the implementation, but will prioritize reviewing and merging the PR once its ready. Thanks!

---

<div class="post-metadata">

**Author:** ![VovaVili](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/vovavili/32/380_2.png) [@VovaVili](https://discourse.greatexpectations.io/u/VovaVili)\
**Post date:** [July 27, 2025, 1:56am UTC](https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227/3 "2025-07-27T01:56:22Z")

</div>

Hey, I have a (possibly preliminary) pull request ready [here](https://github.com/great-expectations/great_expectations/pull/11315). Please let me know if any further revision or input is needed from my side.

---

<div class="post-metadata">

**Author:** ![VovaVili](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.greatexpectations.io/vovavili/32/380_2.png) [@VovaVili](https://discourse.greatexpectations.io/u/VovaVili)\
**Post date:** [September 4, 2025, 7:17pm UTC](https://discourse.greatexpectations.io/t/i-would-like-to-contribute-a-feature-for-sql-templating/2227/4 "2025-09-04T19:17:58Z")

</div>

I fixed the failing unit tests. Is there any anything that is needed from my side from now on?
