Skip to content

feat: Rename FunctionVolatility and FunctionParallel members to lowercase - #151

Merged
DanCardin merged 2 commits into
DanCardin:mainfrom
Dan-Knott:dk/lowercase-function-enum-members
Oct 23, 2026
Merged

DanCardin merged 2 commits into
DanCardin:mainfrom
Dan-Knott:dk/lowercase-function-enum-members

Conversation

@Dan-Knott

Copy link
Copy Markdown
Contributor

Every other enum in the library uses lowercase member names, so these two were the odd ones out.

This is a breaking change, let me know if you would prefer we make it a deprecation instead.

…case.

Every other enum in the library uses lowercase member names, so these two were the odd ones out. The members are renamed (e.g. FunctionVolatility.STABLE becomes FunctionVolatility.stable) with their SQL values unchanged.
@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.93%. Comparing base (4a9bb9d) to head (c560c6a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #151   +/-   ##
=======================================
  Coverage   89.92%   89.93%           
=======================================
  Files          86       86           
  Lines        4147     4151    +4     
  Branches      866      864    -2     
=======================================
+ Hits         3729     3733    +4     
  Misses        338      338           
  Partials       80       80           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

VOLATILE = "VOLATILE"
STABLE = "STABLE"
IMMUTABLE = "IMMUTABLE"
volatile = "VOLATILE"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this would be a good idea?

Suggested change
volatile = "VOLATILE"
class FunctionVolatility(enum.Enum):
volatile = "VOLATILE"
FunctionVolatility.volatile._add_alias_("VOLATILE")

that way it's not a hard breaking change but presumably linters will not understand this and produce an ignorable lint warning.

I probably would also merge as-is, it just seemed like a relatively easy way to somewhat maintain backwards compat.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of add_alias. It would require bumping the min python version to 3.13

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, drat. looking at the source, it's moderately complicated but ultimately most of it seems unimportant and it could probably be hacked in. but perhaps that pushes it into the realm of not being worth it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative would be removing the @enum.unique decorator, then directly aliasing like this:

class FunctionVolatility(FromStrings):
    volatile = "VOLATILE"
    stable = "STABLE"
    immutable = "IMMUTABLE"

    VOLATILE = volatile
    STABLE = stable
    IMMUTABLE = immutable

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm that's true. i guess i was thinking about solutions where the option identity would be the same but in reality we're not really doing any checking/matching all over the place against the values such that the identity would be important, it's just used to render the option to sql so this also seems plausibly fine.

the rendering code would presumably just need to be made to compare against either in order to avoid rendering it when its not necessary.

I'd be happy with that option as well.

@DanCardin
DanCardin merged commit 0ac22f9 into DanCardin:main Oct 23, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants