Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
f41a9a1f
Commit
f41a9a1f
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add better help to scripts/port_from_sqlite_to_postgres.py
parent
1783c7ca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/port_from_sqlite_to_postgres.py
+27
-5
27 additions, 5 deletions
scripts/port_from_sqlite_to_postgres.py
with
27 additions
and
5 deletions
scripts/port_from_sqlite_to_postgres.py
+
27
−
5
View file @
f41a9a1f
...
...
@@ -671,15 +671,30 @@ class TerminalProgress(Progress):
if
__name__
==
"
__main__
"
:
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
(
description
=
"
A script to port an existing synapse SQLite database to
"
"
a new PostgreSQL database.
"
)
parser
.
add_argument
(
"
-v
"
,
action
=
'
store_true
'
)
parser
.
add_argument
(
"
--curses
"
,
action
=
'
store_true
'
)
parser
.
add_argument
(
"
--sqlite-database
"
)
parser
.
add_argument
(
"
--postgres-config
"
,
type
=
argparse
.
FileType
(
'
r
'
),
"
--sqlite-database
"
,
required
=
True
,
help
=
"
The snapshot of the SQLite database file. This must not be
"
"
currently used by a running synapse server
"
)
parser
.
add_argument
(
"
--postgres-config
"
,
type
=
argparse
.
FileType
(
'
r
'
),
required
=
True
,
help
=
"
The database config file for the PostgreSQL database
"
)
parser
.
add_argument
(
"
--curses
"
,
action
=
'
store_true
'
,
help
=
"
display a curses based progress UI
"
)
parser
.
add_argument
(
"
--batch-size
"
,
type
=
int
,
default
=
1000
)
parser
.
add_argument
(
"
--batch-size
"
,
type
=
int
,
default
=
1000
,
help
=
"
The number of rows to select from the SQLite table each
"
"
iteration [default=1000]
"
,
)
args
=
parser
.
parse_args
()
...
...
@@ -705,6 +720,13 @@ if __name__ == "__main__":
postgres_config
=
yaml
.
safe_load
(
args
.
postgres_config
)
if
"
name
"
not
in
postgres_config
:
sys
.
stderr
.
write
(
"
Malformed database config: no
'
name
'"
)
sys
.
exit
(
2
)
if
postgres_config
[
"
name
"
]
!=
"
psycopg2
"
:
sys
.
stderr
.
write
(
"
Database must use
'
psycopg2
'
connector.
"
)
sys
.
exit
(
3
)
def
start
(
stdscr
=
None
):
if
stdscr
:
progress
=
CursesProgress
(
stdscr
)
...
...
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