-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #470 from atlanhq/FT-633
FT-633: Added `creator()` and `updater()` methods to `Procedure` asset
- Loading branch information
Showing
19 changed files
with
998 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. _dataverse: | ||
|
||
Dataverse | ||
========= | ||
|
||
.. module:: pyatlan.model.assets | ||
:no-index: | ||
|
||
.. autoclass:: Dataverse | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. _dataverseattribute: | ||
|
||
DataverseAttribute | ||
================== | ||
|
||
.. module:: pyatlan.model.assets | ||
:no-index: | ||
|
||
.. autoclass:: DataverseAttribute | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.. _dataverseentity: | ||
|
||
DataverseEntity | ||
=============== | ||
|
||
.. module:: pyatlan.model.assets | ||
:no-index: | ||
|
||
.. autoclass:: DataverseEntity | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
pyatlan/generator/templates/methods/asset/procedure.jinja2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
@overload | ||
@classmethod | ||
def creator( | ||
cls, | ||
*, | ||
name: str, | ||
schema_qualified_name: str, | ||
definition: str, | ||
) -> Procedure: ... | ||
|
||
@overload | ||
@classmethod | ||
def creator( | ||
cls, | ||
*, | ||
name: str, | ||
schema_qualified_name: str, | ||
schema_name: str, | ||
database_name: str, | ||
database_qualified_name: str, | ||
connection_qualified_name: str, | ||
definition: str, | ||
) -> Procedure: ... | ||
|
||
@classmethod | ||
@init_guid | ||
def creator( | ||
cls, | ||
*, | ||
name: str, | ||
definition: str, | ||
schema_qualified_name: str, | ||
schema_name: Optional[str] = None, | ||
database_name: Optional[str] = None, | ||
database_qualified_name: Optional[str] = None, | ||
connection_qualified_name: Optional[str] = None, | ||
) -> Procedure: | ||
attributes = Procedure.Attributes.create( | ||
name=name, | ||
definition=definition, | ||
schema_qualified_name=schema_qualified_name, | ||
schema_name=schema_name, | ||
database_name=database_name, | ||
database_qualified_name=database_qualified_name, | ||
connection_qualified_name=connection_qualified_name, | ||
) | ||
return cls(attributes=attributes) | ||
|
||
@classmethod | ||
@init_guid | ||
def updater(cls, *, name: str, qualified_name: str, definition: str) -> Procedure: | ||
validate_required_fields( | ||
["name", "qualified_name", "definition"], | ||
[name, qualified_name, definition], | ||
) | ||
procedure = Procedure( | ||
attributes=Procedure.Attributes(qualified_name=qualified_name, name=name) | ||
) | ||
procedure.definition = definition | ||
return procedure | ||
|
||
def trim_to_required(self: Procedure) -> Procedure: | ||
return self.updater( | ||
qualified_name=self.qualified_name or "", | ||
name=self.name or "", | ||
definition=self.definition or "", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
pyatlan/generator/templates/methods/attribute/procedure.jinja2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
@classmethod | ||
@init_guid | ||
def create( | ||
cls, | ||
*, | ||
name: str, | ||
definition: str, | ||
schema_qualified_name: Optional[str] = None, | ||
schema_name: Optional[str] = None, | ||
database_name: Optional[str] = None, | ||
database_qualified_name: Optional[str] = None, | ||
connection_qualified_name: Optional[str] = None, | ||
) -> Procedure.Attributes: | ||
validate_required_fields( | ||
["name", "definition", "schema_qualified_name"], | ||
[name, definition, schema_qualified_name], | ||
) | ||
assert schema_qualified_name # noqa: S101 | ||
if connection_qualified_name: | ||
connector_name = AtlanConnectorType.get_connector_name( | ||
connection_qualified_name | ||
) | ||
else: | ||
connection_qn, connector_name = AtlanConnectorType.get_connector_name( | ||
schema_qualified_name, "schema_qualified_name", 5 | ||
) | ||
|
||
fields = schema_qualified_name.split("/") | ||
qualified_name = f"{schema_qualified_name}/_procedures_/{name}" | ||
connection_qualified_name = connection_qualified_name or connection_qn | ||
database_name = database_name or fields[3] | ||
schema_name = schema_name or fields[4] | ||
database_qualified_name = ( | ||
database_qualified_name | ||
or f"{connection_qualified_name}/{database_name}" | ||
) | ||
|
||
return Procedure.Attributes( | ||
name=name, | ||
definition=definition, | ||
qualified_name=qualified_name, | ||
database_name=database_name, | ||
database_qualified_name=database_qualified_name, | ||
schema_name=schema_name, | ||
schema_qualified_name=schema_qualified_name, | ||
atlan_schema=Schema.ref_by_qualified_name(schema_qualified_name), | ||
connector_name=connector_name, | ||
connection_qualified_name=connection_qualified_name, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.