-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Spark] Python DeltaTableBuilder API for Identity Columns #3404
[Spark] Python DeltaTableBuilder API for Identity Columns #3404
Conversation
cda45ad
to
934b82a
Compare
@@ -1164,7 +1178,8 @@ def addColumn( | |||
colName: str, | |||
dataType: Union[str, DataType], | |||
nullable: bool = True, | |||
generatedAlwaysAs: Optional[str] = None, | |||
generatedAlwaysAs: Optional[Union[str, IdentityGenerator]] = None, |
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.
API looks nice like this BTW!
Update Update
da7f3d4
to
96dd09c
Compare
Update tests Update test
59a9dc2
to
1a88284
Compare
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!
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.
lgtm! 🎉
24e6aee
to
18202e2
Compare
de0fb05
to
1f844b2
Compare
Which Delta project/connector is this regarding?
Description
This PR is part of #1959
In this PR, we extend the addColumn interface in DeltaTableBuilder to allow for Identity Columns creation.
Resolves #1072
How was this patch tested?
New tests.
Does this PR introduce any user-facing changes?
We update the arguments of addColumn method:
Support a new data type for parameter
generatedAlwaysAs
. Users can specifygeneratedAlwaysAs
asIdentityGenerator
to add an identity column that is GENERATED ALWAYS.Add a new parameter
generatedByDefaultAs
. Users can specifygeneratedByDefaultAs
asIdentityGenerator
to add an identity column that is GENERATED BY DEFAULT.Users can optionally pass in
start
(default = 1) andstep
(default = 1) values to constructIdentityGenerator
object, which specify the start and step value to generate the identity column.Interface
Example Usage