Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
4fb6c7b4
Commit
4fb6c7b4
authored
4 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-4077: updated Python client to fix errors found while running sample - #2
parent
77943a94
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
6 deletions
+35
-6
typedef_create.json
...mple-app/src/main/python/request_json/typedef_create.json
+16
-3
sample_client.py
atlas-examples/sample-app/src/main/python/sample_client.py
+2
-2
typedef.py
intg/src/main/python/apache_atlas/model/typedef.py
+17
-1
No files found.
atlas-examples/sample-app/src/main/python/request_json/typedef_create.json
View file @
4fb6c7b4
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
{
{
"name"
:
"sample_tableType"
,
"name"
:
"sample_tableType"
,
"description"
:
"sample_tableType"
,
"description"
:
"sample_tableType"
,
"category"
:
"ENUM"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"elementDefs"
:
[
"elementDefs"
:
[
{
"value"
:
"MANAGED"
,
"ordinal"
:
1
},
{
"value"
:
"MANAGED"
,
"ordinal"
:
1
},
...
@@ -13,6 +14,7 @@
...
@@ -13,6 +14,7 @@
"structDefs"
:
[
"structDefs"
:
[
{
{
"name"
:
"sample_serdeType"
,
"name"
:
"sample_serdeType"
,
"category"
:
"STRUCT"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
"name"
:
"name"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
false
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"name"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
false
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
...
@@ -23,14 +25,17 @@
...
@@ -23,14 +25,17 @@
"classificationDefs"
:
[
"classificationDefs"
:
[
{
{
"name"
:
"sample_pii"
,
"name"
:
"sample_pii"
,
"category"
:
"CLASSIFICATION"
,
"typeVersion"
:
"1.0"
"typeVersion"
:
"1.0"
},
},
{
{
"name"
:
"sample_finance"
,
"name"
:
"sample_finance"
,
"category"
:
"CLASSIFICATION"
,
"typeVersion"
:
"1.0"
"typeVersion"
:
"1.0"
},
},
{
{
"name"
:
"sample_metric"
,
"name"
:
"sample_metric"
,
"category"
:
"CLASSIFICATION"
,
"typeVersion"
:
"1.0"
"typeVersion"
:
"1.0"
}
}
],
],
...
@@ -38,6 +43,7 @@
...
@@ -38,6 +43,7 @@
{
{
"name"
:
"sample_db"
,
"name"
:
"sample_db"
,
"superTypes"
:
[
"DataSet"
],
"superTypes"
:
[
"DataSet"
],
"category"
:
"ENTITY"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
"name"
:
"locationUri"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
false
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"locationUri"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
false
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
...
@@ -46,8 +52,9 @@
...
@@ -46,8 +52,9 @@
},
},
{
{
"name"
:
"sample_table"
,
"name"
:
"sample_table"
,
"typeVersion"
:
"1.0"
,
"superTypes"
:
[
"DataSet"
],
"superTypes"
:
[
"DataSet"
],
"category"
:
"ENTITY"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
"name"
:
"createTime"
,
"typeName"
:
"date"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"createTime"
,
"typeName"
:
"date"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"tableType"
,
"typeName"
:
"sample_tableType"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"tableType"
,
"typeName"
:
"sample_tableType"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
...
@@ -58,8 +65,9 @@
...
@@ -58,8 +65,9 @@
},
},
{
{
"name"
:
"sample_column"
,
"name"
:
"sample_column"
,
"typeVersion"
:
"1.0"
,
"superTypes"
:
[
"DataSet"
],
"superTypes"
:
[
"DataSet"
],
"category"
:
"ENTITY"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
"name"
:
"dataType"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"dataType"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"comment"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
}
{
"name"
:
"comment"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
}
...
@@ -67,8 +75,9 @@
...
@@ -67,8 +75,9 @@
},
},
{
{
"name"
:
"sample_process"
,
"name"
:
"sample_process"
,
"typeVersion"
:
"1.0"
,
"superTypes"
:
[
"Process"
],
"superTypes"
:
[
"Process"
],
"category"
:
"ENTITY"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
"name"
:
"userName"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"userName"
,
"typeName"
:
"string"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"startTime"
,
"typeName"
:
"long"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
{
"name"
:
"startTime"
,
"typeName"
:
"long"
,
"cardinality"
:
"SINGLE"
,
"isOptional"
:
true
,
"isUnique"
:
false
,
"isIndexable"
:
true
},
...
@@ -82,6 +91,7 @@
...
@@ -82,6 +91,7 @@
{
{
"name"
:
"sample_db_tables"
,
"name"
:
"sample_db_tables"
,
"description"
:
"Tables of a db"
,
"description"
:
"Tables of a db"
,
"category"
:
"RELATIONSHIP"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"relationshipCategory"
:
"AGGREGATION"
,
"relationshipCategory"
:
"AGGREGATION"
,
"propagateTags"
:
"NONE"
,
"propagateTags"
:
"NONE"
,
...
@@ -91,6 +101,7 @@
...
@@ -91,6 +101,7 @@
{
{
"name"
:
"sample_table_columns"
,
"name"
:
"sample_table_columns"
,
"description"
:
"Columns of a table"
,
"description"
:
"Columns of a table"
,
"category"
:
"RELATIONSHIP"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"relationshipCategory"
:
"COMPOSITION"
,
"relationshipCategory"
:
"COMPOSITION"
,
"propagateTags"
:
"NONE"
,
"propagateTags"
:
"NONE"
,
...
@@ -102,6 +113,7 @@
...
@@ -102,6 +113,7 @@
{
{
"name"
:
"sample_bm"
,
"name"
:
"sample_bm"
,
"description"
:
"Sample business metadata"
,
"description"
:
"Sample business metadata"
,
"category"
:
"BUSINESS_METADATA"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
{
...
@@ -147,6 +159,7 @@
...
@@ -147,6 +159,7 @@
{
{
"name"
:
"sample_bm_mv"
,
"name"
:
"sample_bm_mv"
,
"description"
:
"Sample business metadata with multi-value attributes"
,
"description"
:
"Sample business metadata with multi-value attributes"
,
"category"
:
"BUSINESS_METADATA"
,
"typeVersion"
:
"1.0"
,
"typeVersion"
:
"1.0"
,
"attributeDefs"
:
[
"attributeDefs"
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
atlas-examples/sample-app/src/main/python/sample_client.py
View file @
4fb6c7b4
...
@@ -48,10 +48,10 @@ class SampleApp:
...
@@ -48,10 +48,10 @@ class SampleApp:
client
=
AtlasClient
(
url
,
(
username
,
password
))
client
=
AtlasClient
(
url
,
(
username
,
password
))
self
.
__entity_example
(
client
)
self
.
__typedef_example
(
client
)
self
.
__typedef_example
(
client
)
self
.
__entity_example
(
client
)
self
.
__lineage_example
(
client
)
self
.
__lineage_example
(
client
)
self
.
__discovery_example
(
client
)
self
.
__discovery_example
(
client
)
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/python/apache_atlas/model/typedef.py
View file @
4fb6c7b4
...
@@ -103,6 +103,17 @@ class AtlasRelationshipDef(AtlasStructDef):
...
@@ -103,6 +103,17 @@ class AtlasRelationshipDef(AtlasStructDef):
AtlasStructDef
.
__init__
(
self
,
attrs
)
AtlasStructDef
.
__init__
(
self
,
attrs
)
self
.
category
=
TypeCategory
.
RELATIONSHIP
.
name
self
.
category
=
TypeCategory
.
RELATIONSHIP
.
name
self
.
relationshipCategory
=
attrs
.
get
(
'relationshipCategory'
);
self
.
relationshipLabel
=
attrs
.
get
(
'relationshipLabel'
);
self
.
propagateTags
=
attrs
.
get
(
'propagateTags'
);
self
.
endDef1
=
attrs
.
get
(
'endDef1'
);
self
.
endDef2
=
attrs
.
get
(
'endDef2'
);
def
type_coerce_attrs
(
self
):
super
(
AtlasRelationshipDef
,
self
)
.
type_coerce_attrs
()
self
.
endDef1
=
type_coerce
(
self
.
endDef1
,
AtlasRelationshipEndDef
)
self
.
endDef2
=
type_coerce
(
self
.
endDef2
,
AtlasRelationshipEndDef
)
class
AtlasBusinessMetadataDef
(
AtlasStructDef
):
class
AtlasBusinessMetadataDef
(
AtlasStructDef
):
...
@@ -168,7 +179,12 @@ class AtlasRelationshipEndDef(AtlasBase):
...
@@ -168,7 +179,12 @@ class AtlasRelationshipEndDef(AtlasBase):
def
__init__
(
self
,
attrs
=
{}):
def
__init__
(
self
,
attrs
=
{}):
AtlasBase
.
__init__
(
self
,
attrs
)
AtlasBase
.
__init__
(
self
,
attrs
)
self
.
cardinality
=
non_null
(
self
.
cardinality
,
Cardinality
.
SINGLE
.
name
)
self
.
type
=
attrs
.
get
(
'type'
)
self
.
name
=
attrs
.
get
(
'name'
)
self
.
isContainer
=
attrs
.
get
(
'isContainer'
)
self
.
cardinality
=
attrs
.
get
(
'cardinality'
)
self
.
isLegacyAttribute
=
attrs
.
get
(
'isLegacyAttribute'
)
self
.
description
=
attrs
.
get
(
'description'
)
class
AtlasTypesDef
(
AtlasBase
):
class
AtlasTypesDef
(
AtlasBase
):
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment