Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
Rule Engine Service
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
brooklyn
Rule Engine Service
Commits
b8c43c01
Commit
b8c43c01
authored
Jan 11, 2023
by
Sarah Abrishami
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new apis
parent
4f6f5272
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
app/main/utils/db_util.py
app/main/utils/db_util.py
+11
-2
No files found.
app/main/utils/db_util.py
View file @
b8c43c01
...
...
@@ -20,6 +20,15 @@ def return_obj(oid, what, to_dict=True):
return
obj
def
return_all_objs
(
what
,
to_dict
=
True
):
dct
=
{
'ds'
:
Dataset
,
'rg'
:
RuleGroup
,
'rule'
:
Rule
}
objs
=
db
.
session
.
query
(
dct
[
what
])
.
all
()
if
to_dict
:
return
[
obj
.
to_dict
()
for
obj
in
objs
]
else
:
return
objs
def
rm_obj
(
oid
,
what
):
dct
=
{
'ds'
:
Dataset
,
'rg'
:
RuleGroup
,
'rule'
:
Rule
}
obj
=
db
.
session
.
query
(
dct
[
what
])
.
filter
(
dct
[
what
]
.
uid
==
oid
)
.
one
()
...
...
@@ -28,6 +37,6 @@ def rm_obj(oid, what):
return
True
def
return_project_rules
(
project_id
):
def
return_project_rules
(
project_id
,
flat
=
True
):
rules
=
db
.
session
.
query
(
Rule
)
.
filter
(
Rule
.
project_id
==
project_id
)
.
all
()
return
[
r
.
to_dict
()
for
r
in
rules
]
return
[
r
.
to_dict
(
flat
=
flat
)
for
r
in
rules
]
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