Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
6c5f4f6e
Commit
6c5f4f6e
authored
7 years ago
by
Adriaan Renting
Browse files
Options
Downloads
Patches
Plain Diff
Task #10876: Changes as the result of testing and integration.
parent
99783196
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
support/tools/MoM/convert_split_and_rename_mom_database_sqldump.py
+9
-3
9 additions, 3 deletions
...ools/MoM/convert_split_and_rename_mom_database_sqldump.py
with
9 additions
and
3 deletions
support/tools/MoM/convert_split_and_rename_mom_database_sqldump.py
+
9
−
3
View file @
6c5f4f6e
#!/usr/bin/python
import
os
# This script reads infile and creates sql files for each part in the infile in the
# outdir directory. It also replaces references to the indatabase with references
# to the outdatabase.
...
...
@@ -26,7 +26,11 @@ outIDMdatabase = "lofar_mom_test_rt_trigger_idm"
inUserAdmindatabase
=
"
useradministration
"
outUserAdmindatabase
=
"
lofar_mom_test_rt_trigger_useradmin
"
outfile
=
open
(
outdir
+
"
000000_CREATE_DATABASE.sql
"
,
'
w
'
)
if
os
.
listdir
(
outdir
)
!=
[]:
print
"
Output directory not empty! Aborting
"
exit
()
outfile
=
open
(
outdir
+
"
000000_CREATE_DATABASE.sql
"
,
'
w
'
)
# Please note that "Comments" in the SQL that look like this
# /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
...
...
@@ -82,6 +86,7 @@ outfile = open(outdir +"000000_CREATE_DATABASE.sql", 'w')
# - Generated views for the BiRT viewer (starting with /*!50001 VIEW )
# - Comments
# - USE statements
# - Foreign keys
# We only check for these and not all lines of the SQL, as this saves having to parse the
# WRITE statements that are 99% of the SQL and by far the longest lines.
...
...
@@ -94,7 +99,8 @@ possible_trigger = False
trigger
=
False
with
open
(
infile
)
as
f
:
for
line
in
f
:
if
not
use_found
or
trigger
or
(
line
[
0
:
13
]
==
"
/*!50001 VIEW
"
)
or
(
line
[
0
:
2
]
==
'
--
'
):
if
not
use_found
or
trigger
or
(
line
[
0
:
13
]
==
"
/*!50001 VIEW
"
)
or
(
line
[
0
:
2
]
==
'
--
'
)
or
\
"
CONSTRAINT
"
in
line
[
0
:
len
(
"
CONSTRAINT
"
)
+
2
]:
# "/*!50001 VIEW" are special BiRT viewer generated views
if
indatabase
in
line
:
#doing this for each line would be expensive
line
=
line
.
replace
(
indatabase
,
outdatabase
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment