Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
haoyuz3
SQL Provenance
Commits
d7a06394
Commit
d7a06394
authored
Sep 23, 2020
by
Haoyu Z
Browse files
debug
parent
b393d3f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
provsql/provenance.py
View file @
d7a06394
...
...
@@ -52,17 +52,17 @@ def preprocess_query(query, cur, conn):
tables
=
tablesInQuery
(
query
)
output
=
[]
for
table
in
tables
:
if
table
in
tablesWithProvenance
:
co
ntinue
command
1
=
"select
add
_provenance
('{}
');"
.
format
(
table
)
command2
=
"select create_provenance_mapping('{}_provtuple_mapping','{}','provtuple');"
.
format
(
table
,
table
)
ut
.
commitAndExecute
(
conn
,
cur
,
command
1
)
ut
.
commitAndExecute
(
conn
,
cur
,
command2
)
if
table
not
in
tablesWithProvenance
:
co
mmand1
=
"select add_provenance('{}');"
.
format
(
table
)
command
2
=
"select
create
_provenance
_mapping('{}_provtuple_mapping','{}','provtuple
');"
.
format
(
table
,
table
)
ut
.
commitAndExecute
(
conn
,
cur
,
command1
)
ut
.
commitAndExecute
(
conn
,
cur
,
command
2
)
tablesWithProvenance
[
table
]
=
1
formula
=
" formula(provenance(), '{}_provtuple_mapping'), "
.
format
(
table
)
index
=
query
.
find
(
'select'
)
+
6
tmp
=
query
[:
index
]
+
formula
+
query
[
index
:]
output
.
append
(
tmp
)
tablesWithProvenance
[
table
]
=
1
return
(
tables
,
output
)
#formulas:[[formula1, formula2, ...],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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