Skip to content
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

Multiple decorator error when using @schema.output #1163

Open
sT0v opened this issue Oct 2, 2024 — with Slack · 1 comment
Open

Multiple decorator error when using @schema.output #1163

sT0v opened this issue Oct 2, 2024 — with Slack · 1 comment

Comments

Copy link
Contributor

sT0v commented Oct 2, 2024

This is pretty self-explanatory, but just wanted to make sure that this was in fact illegal?

@schema.output(
  ("ticker", "str"),
  ("fee", "float")
)
@tag(table_type="reference")
def ref_table_1() -> pd.DataFrame:
  ...

ValueError: Got multiple decorators for decorator @<class 'hamilton.function_modifiers.metadata.SchemaOutput'>. Only one allowed.

Slack Message

@elijahbenizzy
Copy link
Collaborator

Yeah, this should work... I think there's some bug in how we handle this:

What's happening is it's going by lifecycle step, but it should really go by class... The SchemaOutput is not respecting the contract (E.G. that you can't override allow_multiple). But we should clarify this, or just allow multiple and have a check on the tag decorator to ensure they don't overwrite.

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

No branches or pull requests

2 participants