Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
3f61d953
Commit
3f61d953
authored
Jun 29, 2021
by
Manuel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/enums' into develop
parents
391ba2ad
87ec9330
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
547 additions
and
85 deletions
+547
-85
MessageHandler.py
...ntic-linking-microservice/app/messaging/MessageHandler.py
+12
-0
add_crowdjournalism_schema.py
...se_scripts/crowd_journalism/add_crowdjournalism_schema.py
+1
-1
add_classification.py
...ase_scripts/crowd_journalism/tables/add_classification.py
+1
-0
add_event.py
...add_use_case_scripts/crowd_journalism/tables/add_event.py
+2
-1
add_purchase.py
..._use_case_scripts/crowd_journalism/tables/add_purchase.py
+4
-0
add_tag.py
.../_add_use_case_scripts/crowd_journalism/tables/add_tag.py
+3
-7
add_video.py
...add_use_case_scripts/crowd_journalism/tables/add_video.py
+4
-1
sample_trace.json
...service/app/_add_use_case_scripts/debug/sample_trace.json
+16
-0
add_pizza_table.py
...app/_add_use_case_scripts/debug/tables/add_pizza_table.py
+4
-2
clone_use_case.py
...ion-hub/business-logic-microservice/app/clone_use_case.py
+106
-0
routes.yml
...on-hub/business-logic-microservice/app/configs/routes.yml
+103
-0
enum.py
...n-hub/business-logic-microservice/app/db/entities/enum.py
+36
-0
enum_repository.py
...hub/business-logic-microservice/app/db/enum_repository.py
+63
-0
main.py
...participation-hub/business-logic-microservice/app/main.py
+1
-0
enum.py
...pation-hub/business-logic-microservice/app/routes/enum.py
+61
-0
MessageHandler.py
...ce-retrieval-microservice/app/messaging/MessageHandler.py
+98
-66
rest_fetcher.py
...race-retrieval-microservice/app/messaging/rest_fetcher.py
+32
-7
No files found.
src/data-hub/semantic-linking-microservice/app/messaging/MessageHandler.py
View file @
3f61d953
...
...
@@ -54,15 +54,21 @@ class MessageHandler:
layers
=
[
Layer
.
from_business_logic_dict
(
row
)
for
row
in
json
.
loads
(
response
.
text
)]
LOGGER
.
info
(
f
"Received {len(layers)} layers"
)
# update local DB, insert each layer that does not already exists
for
layer
in
layers
:
print
(
f
"Add layer to DB: {layer.to_serializable_dict(for_db=True)}"
)
self
.
_repository
.
delete_layer
(
layer
)
self
.
_repository
.
add_layer
(
layer
)
if
len
(
layers
)
==
0
:
LOGGER
.
error
(
f
"no schema information found"
)
return
layers
def
handle_new_trace
(
self
,
content
:
Dict
):
LOGGER
.
info
(
"new trace!"
)
if
"use_case"
not
in
content
or
"id"
not
in
content
or
"properties"
not
in
content
or
"table"
not
in
content
:
LOGGER
.
error
(
f
"Missing fields in trace, required fields: (use_case, id, properties, table), given fields: ({content.keys()})"
)
return
...
...
@@ -82,6 +88,7 @@ class MessageHandler:
LOGGER
.
warning
(
f
"No layers available for '{use_case}'.'{table}', ignoring trace."
)
return
LOGGER
.
info
(
f
"{len(layers)} layers available"
)
nodes
=
[]
for
layer
in
layers
:
...
...
@@ -97,7 +104,12 @@ class MessageHandler:
nodes
.
append
(
node
)
if
len
(
nodes
)
>
0
:
LOGGER
.
info
(
f
"{len(layers)} layers available"
)
self
.
_repository
.
add_layer_nodes
(
nodes
)
else
:
LOGGER
.
error
(
f
"did NOT add nodes..."
)
LOGGER
.
info
(
"done"
)
def
handle_new_traces_available
(
self
):
# get all traces and call the Processor
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/add_crowdjournalism_schema.py
View file @
3f61d953
...
...
@@ -29,7 +29,7 @@ def add_use_case(use_case: str):
print
(
url
+
": "
+
str
(
response
.
content
))
if
__name__
==
"__main__"
:
use_case
=
"crowd-journalism"
use_case
=
"crowd-journalism
-enum
"
# disable ssl warnings :)
requests
.
packages
.
urllib3
.
disable_warnings
()
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_classification.py
View file @
3f61d953
...
...
@@ -18,6 +18,7 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid"
columns
[
"objecttype"
]
=
"enum(objecttype)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_event.py
View file @
3f61d953
...
...
@@ -17,7 +17,8 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"eventid"
columns
[
"firstTag"
]
=
"tags[0]"
columns
[
"firstTag"
]
=
"enum(tags[0])"
columns
[
"objecttype"
]
=
"enum(objecttype)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_purchase.py
View file @
3f61d953
...
...
@@ -17,6 +17,10 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid+ownerid"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"userid"
]
=
"enum(userid)"
columns
[
"ownerid"
]
=
"enum(ownerid)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_tag.py
View file @
3f61d953
...
...
@@ -5,13 +5,9 @@ def add_table(use_case: str, table_name: str):
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"tag"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{}
columns
[
"tag"
]
=
"enum(tag)"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"UniqueID"
]
=
"objecttype+tag"
table
=
{
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_video.py
View file @
3f61d953
...
...
@@ -33,7 +33,10 @@ def add_table(use_case: str, table_name: str):
columns
[
"UniqueID"
]
=
"videoid"
columns
[
"encodedAudio"
]
=
"codec//audio"
columns
[
"encodedVideo"
]
=
"codec//video"
columns
[
"firstTag"
]
=
"tags[0]"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"duration"
]
=
"enum(duration)"
columns
[
"firstTag"
]
=
"enum(tags[0])"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/debug/sample_trace.json
0 → 100644
View file @
3f61d953
{
"ApplicationType"
:
"debug"
,
"docType"
:
"pizza"
,
"id"
:
1
,
"dough"
:
{
"type"
:
"wheat"
,
"spinach"
:
false
},
"toppings"
:
[
{
"name"
:
"cheese"
,
"price"
:
0.99
}
],
"name"
:
"Margherita"
}
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/debug/tables/add_pizza_table.py
View file @
3f61d953
...
...
@@ -64,6 +64,7 @@ def main(use_case: str):
{
"UniqueID"
:
"id"
,
"name"
:
"name"
,
"nameIndex"
:
"enum(name)"
,
"doughType"
:
"dough//type"
,
"hasSpinach"
:
"dough//spinach"
,
"firstTopping"
:
"toppings[0]//name"
,
...
...
@@ -81,10 +82,11 @@ def main(use_case: str):
"name"
:
"Price_Layer"
,
"properties"
:
[
"UniqueID"
,
"firstToppingPrice"
"firstToppingPrice"
,
"nameIndex"
],
"cluster_properties"
:
[
"firstToppingPrice"
"firstToppingPrice"
,
]
},
{
...
...
src/participation-hub/business-logic-microservice/app/clone_use_case.py
0 → 100644
View file @
3f61d953
import
sys
import
os
import
json
from
pathlib
import
Path
from
typing
import
Dict
,
Any
import
requests
requests
.
packages
.
urllib3
.
disable_warnings
()
modules_paths
=
[
'.'
,
'../../../modules/'
]
for
modules_path
in
modules_paths
:
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
import
network_constants
as
nc
from
security.token_manager
import
TokenManager
use_case_from
=
"crowd-journalism"
use_case_to
=
"crowd-journalism-enum"
# 1. get all tables for the use-case
from
db.entities.table
import
Table
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case_from}/tables"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
tables
=
json
.
loads
(
response
.
content
)
tables
=
[
Table
.
from_serializable_dict
(
row
)
for
row
in
tables
]
print
(
f
"|tables|={len(tables)}"
)
#2. fetch layers for tables
from
db.entities.layer_adapter
import
LayerAdapter
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case_from}/layers"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
layers
=
json
.
loads
(
response
.
content
)
layers
=
[
LayerAdapter
.
from_serializable_dict
(
row
)
for
row
in
layers
]
print
(
f
"|layers|={len(layers)}"
)
# 3. fetch transactions for use-case
url
=
f
"https://articonf1.itec.aau.at:30001/api/use_cases/{use_case_from}/transactions"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
transactions
=
json
.
loads
(
response
.
content
)
print
(
f
"|transactions|={len(transactions)}"
)
ignored_fields
=
[
"ApplicationType"
,
"docType"
,
"UniqueID"
]
for
table
in
tables
:
for
transaction
in
transactions
:
if
transaction
[
"table"
]
!=
table
.
name
:
continue
data
=
{
"ApplicationType"
:
use_case_to
,
"docType"
:
table
.
name
,
}
if
table
.
name
==
"video"
:
data
[
"codec"
]
=
{
"audio"
:
transaction
[
"properties"
][
"encodedAudio"
],
"video"
:
transaction
[
"properties"
][
"encodedVideo"
]
}
data
[
"tags"
]
=
[
transaction
[
"properties"
][
"firstTag"
]]
if
table
.
name
==
"event"
:
data
[
"tags"
]
=
[
transaction
[
"properties"
][
"firstTag"
]]
for
key
,
value
in
transaction
[
"properties"
]
.
items
():
if
key
not
in
ignored_fields
:
data
[
key
]
=
value
# post the new trace
url
=
f
"https://articonf1.itec.aau.at:30401/api/trace"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
data
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
src/participation-hub/business-logic-microservice/app/configs/routes.yml
View file @
3f61d953
...
...
@@ -515,6 +515,109 @@ paths:
description
:
"
Field
in
request
is
missing"
'
403'
:
description
:
"
Confirmation
required"
#####
# END LAYERS
#####
#####
# ENUMS
#####
/enums
:
get
:
security
:
-
JwtRegular
:
[]
operationId
:
"
routes.enum.all"
tags
:
-
"
Enums"
summary
:
"
Retrieve
all
Enums
from
the
DB"
description
:
"
Retrieve
all
Enums
from
the
DB"
responses
:
'
200'
:
description
:
"
Successful
Request"
/use-cases/{use_case}/enums
:
get
:
security
:
-
JwtRegular
:
[]
operationId
:
"
routes.enum.get_all_for_use_case"
tags
:
-
"
Enums"
summary
:
"
Retrieve
one
Enum
from
the
DB"
description
:
"
Retrieve
one
Enum
from
the
DB"
parameters
:
-
name
:
"
use_case"
in
:
"
path"
description
:
"
Name
of
the
Use-Case
the
Enum
belongs
to"
required
:
true
type
:
"
string"
responses
:
'
200'
:
description
:
"
Successful
Request"
'
404'
:
description
:
"
Enum
does
not
exist"
/use-cases/{use_case}/tables/{table}/enum/{name}
:
put
:
security
:
-
JwtRegular
:
[]
operationId
:
"
routes.enum.put_new"
tags
:
-
"
Enums"
summary
:
"
Updates
an
existing
Enum
with
a
new
value."
description
:
"
Updates
an
existing
Enum
with
a
new
value."
parameters
:
-
name
:
"
use_case"
in
:
"
path"
description
:
"
Name
of
the
Use-Case
the
Enum
belongs
to"
required
:
true
type
:
"
string"
-
name
:
"
table"
in
:
"
path"
description
:
"
Name
of
the
Table
the
Enum
belongs
to"
required
:
true
type
:
"
string"
-
name
:
"
name"
in
:
"
path"
description
:
"
Name
of
the
Enum"
required
:
true
type
:
"
string"
-
name
:
value
in
:
query
description
:
Value of the Enum.
required
:
true
type
:
string
responses
:
'
200'
:
description
:
"
Successful
Request"
'
404'
:
description
:
"
Enum
does
not
exist"
get
:
security
:
-
JwtRegular
:
[]
operationId
:
"
routes.enum.one"
tags
:
-
"
Enums"
summary
:
"
Retrieve
one
Enum
from
the
DB"
description
:
"
Retrieve
one
Enum
from
the
DB"
parameters
:
-
name
:
"
use_case"
in
:
"
path"
description
:
"
Name
of
the
Use-Case
the
Enum
belongs
to"
required
:
true
type
:
"
string"
-
name
:
"
table"
in
:
"
path"
description
:
"
Name
of
the
Table
the
Enum
belongs
to"
required
:
true
type
:
"
string"
-
name
:
"
name"
in
:
"
path"
description
:
"
Name
of
the
Enum"
required
:
true
type
:
"
string"
responses
:
'
200'
:
description
:
"
Successful
Request"
'
404'
:
description
:
"
Enum
does
not
exist"
definitions
:
LayerMapping
:
...
...
src/participation-hub/business-logic-microservice/app/db/entities/enum.py
0 → 100644
View file @
3f61d953
from
typing
import
Dict
class
Enum
:
def
__init__
(
self
,
use_case
:
str
,
table
:
str
,
name
:
str
,
value
:
str
,
index
:
int
):
self
.
use_case
=
use_case
self
.
table
=
table
self
.
name
=
name
self
.
value
=
value
self
.
index
=
index
def
to_serializable_dict
(
self
)
->
Dict
:
return
{
"use_case"
:
self
.
use_case
,
"table"
:
self
.
table
,
"name"
:
self
.
name
,
"value"
:
self
.
value
,
"index"
:
self
.
index
,
}
@
staticmethod
def
from_serializable_dict
(
enum_dict
:
Dict
):
'''
creates a layer object from a dictionary. has to have the following keys:
- name
- properties
- cluster_properties
- use_case
'''
return
Enum
(
enum_dict
[
"use_case"
],
enum_dict
[
"table"
],
enum_dict
[
"name"
],
enum_dict
[
"value"
],
enum_dict
[
"index"
],
)
src/participation-hub/business-logic-microservice/app/db/enum_repository.py
0 → 100644
View file @
3f61d953
# global imports (dont't worry, red is normal)
import
network_constants
as
netconst
from
database.MongoRepositoryBase
import
MongoRepositoryBase
from
db.entities.enum
import
Enum
from
typing
import
List
class
EnumRepository
(
MongoRepositoryBase
):
'''This is a repository for MongoDb.'''
def
__init__
(
self
):
super
()
.
__init__
(
netconst
.
BUSINESS_LOGIC_DB_HOSTNAME
,
netconst
.
BUSINESS_LOGIC_DB_PORT
,
'business-logic-db'
)
self
.
_enum_collection
=
'enums'
def
all
(
self
)
->
List
[
Enum
]:
result
=
super
()
.
get_entries
(
self
.
_enum_collection
,
projection
=
{
'_id'
:
False
})
return
[
Enum
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
def
all_for_use_case
(
self
,
use_case
:
str
)
->
List
[
Enum
]:
result
=
super
()
.
get_entries
(
self
.
_enum_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"use_case"
:
use_case
})
return
[
Enum
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
def
all_for_use_case_and_table
(
self
,
use_case
:
str
,
table
:
str
)
->
List
[
Enum
]:
result
=
super
()
.
get_entries
(
self
.
_enum_collection
,
projection
=
{
'_id'
:
False
},
selection
=
{
"use_case"
:
use_case
,
"table"
:
table
})
return
[
Enum
.
from_serializable_dict
(
row
)
for
row
in
list
(
result
)]
def
all_for_use_case_and_table_and_name
(
self
,
name
:
str
,
use_case
:
str
,
table
:
str
)
->
Enum
:
result
=
list
(
super
()
.
get_entries
(
self
.
_enum_collection
,
selection
=
{
"name"
:
name
,
"use_case"
:
use_case
,
"table"
:
table
}))
return
[
Enum
.
from_serializable_dict
(
row
)
for
row
in
result
]
def
delete_all
(
self
):
collection
=
self
.
_database
[
self
.
_enum_collection
]
collection
.
delete_many
({})
def
add
(
self
,
enum
:
Enum
):
super
()
.
insert_entry
(
self
.
_enum_collection
,
enum
.
to_serializable_dict
())
def
update_use_case
(
self
,
enum
:
Enum
,
use_case
:
str
):
collection
=
self
.
_database
[
self
.
_enum_collection
]
collection
.
update_one
({
"name"
:
enum
.
name
,
"use_case"
:
use_case
,
"table"
:
enum
.
table
},
{
"$set"
:
enum
.
to_serializable_dict
()})
def
update
(
self
,
enum
:
Enum
):
collection
=
self
.
_database
[
self
.
_enum_collection
]
collection
.
update_one
({
"name"
:
enum
.
name
,
"use_case"
:
enum
.
use_case
,
"table"
:
enum
.
table
},
{
"$set"
:
enum
.
to_serializable_dict
()})
def
delete
(
self
,
enum
:
Enum
):
collection
=
self
.
_database
[
self
.
_enum_collection
]
collection
.
delete_many
(
{
"name"
:
enum
.
name
,
"use_case"
:
enum
.
use_case
,
"table"
:
enum
.
table
})
src/participation-hub/business-logic-microservice/app/main.py
View file @
3f61d953
...
...
@@ -13,6 +13,7 @@ import connexion
from
security
import
swagger_util
from
env_info
import
is_running_locally
,
get_resources_path
from
flask
import
request
from
flask_cors
import
CORS
from
flask
import
redirect
from
flask_cors
import
CORS
...
...
src/participation-hub/business-logic-microservice/app/routes/enum.py
0 → 100644
View file @
3f61d953
#global imports
from
db.entities.enum
import
Enum
from
db.entities.layer_adapter
import
LayerAdapter
from
db.repository
import
Repository
from
db.table_repository
import
TableRepository
from
db.use_case_repository
import
UseCaseRepository
from
db.enum_repository
import
EnumRepository
import
json
from
flask
import
Response
,
request
table_repository
=
TableRepository
()
use_case_repository
=
UseCaseRepository
()
enum_repository
=
EnumRepository
()
def
all
():
return
[
enum
.
to_serializable_dict
()
for
enum
in
enum_repository
.
all
()]
def
get_all_for_use_case
(
use_case
:
str
):
'''
get all enums assigned to the given use_case
'''
use_case_repository
.
put
(
use_case
)
return
[
enum
.
to_serializable_dict
()
for
enum
in
enum_repository
.
all_for_use_case
(
use_case
)]
def
one
(
use_case
:
str
,
table
:
str
,
name
:
str
):
'''
fetch a single enum from the DB
@params:
use_case - Required : String-identifier for the Use-Case the Enum belongs to
table - Required : unique identifier of the Table the Enum belongs to
name - Required : unique identifier for the Enum
'''
enums
=
enum_repository
.
all_for_use_case_and_table_and_name
(
name
,
use_case
,
table
)
return
Response
(
status
=
200
,
response
=
json
.
dumps
([
enum
.
to_serializable_dict
()
for
enum
in
enums
]))
def
put_new
(
use_case
:
str
,
table
:
str
,
name
:
str
,
value
:
str
):
'''
Put a new Enum to the DB. If the value for this enum already exists, nothing happens.
@params:
use_case - Required : String-identifier for the Use-Case the Enum belongs to
table - Required : unique identifier of the Table the Enum belongs to
name - Required : unique identifier for the Enum
'''
existing_enums
=
enum_repository
.
all_for_use_case_and_table_and_name
(
name
,
use_case
,
table
)
enum_target
=
None
found
=
False
for
enum
in
existing_enums
:
if
enum
.
value
==
value
:
enum_target
=
enum
break
if
enum_target
==
None
:
enum_target
=
Enum
(
use_case
,
table
,
name
,
value
,
len
(
existing_enums
))
enum_repository
.
add
(
enum_target
)
return
Response
(
status
=
200
,
response
=
json
.
dumps
(
enum_target
.
to_serializable_dict
()))
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/MessageHandler.py
View file @
3f61d953
This diff is collapsed.
Click to expand it.
src/transaction-hub-in/trace-retrieval-microservice/app/messaging/rest_fetcher.py
View file @
3f61d953
...
...
@@ -2,23 +2,48 @@ from security.token_manager import TokenManager
import
network_constants
from
typing
import
List
import
json
,
requests
import
json
import
requests
class
RestFetcher
:
def
fetch_enum_value
(
self
,
use_case
:
str
,
table
:
str
,
enum_name
:
str
,
enum_value
:
str
)
->
int
:
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/tables/{table}/enum/{enum_name}?value={enum_value}'
print
(
f
"calling {url}"
)
# query tables for use-case
url
=
url
response
=
requests
.
put
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
},
)
if
response
.
status_code
!=
200
:
raise
ValueError
(
f
"Error while retrieving Enum information.
\t
Status-code:{response.status_code}"
)
enum
=
json
.
loads
(
response
.
text
)
return
enum
[
"index"
]
def
fetch_schema_information
(
self
,
use_case
:
str
)
->
List
:
jwt_token
=
TokenManager
.
getInstance
()
.
getToken
()
# query tables for use-case
url
=
f
'https://{network_constants.BUSINESS_LOGIC_HOSTNAME}:{network_constants.BUSINESS_LOGIC_REST_PORT}/api/use-cases/{use_case}/tables'
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
}
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt_token}"
}
)
if
response
.
status_code
!=
200
:
raise
ValueError
(
f
"Error while retrieving schema information.
\t
Status-code:{response.status_code}"
)
raise
ValueError
(
f
"Error while retrieving schema information.
\t
Status-code:{response.status_code}"
)
tables
=
json
.
loads
(
response
.
text
)
return
tables
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