forked from simonw/sqlite-diffable
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
34 lines (31 loc) · 1019 Bytes
/
__init__.py
File metadata and controls
34 lines (31 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sqlite_diffable.cli
import click
def load(dbpath, directory, replace=False):
params = [dbpath, directory]
if replace:
params.append('--replace')
try:
sqlite_diffable.cli.load(params, standalone_mode=False)
except click.exceptions.ClickException as e:
print("Use the replace parameter to over-write existing tables")
return False
return True
def dump(dbpath, output, tables=[], all=False):
params = [dbpath, output]
if tables:
params += tables
if all:
params.append('--all')
try:
sqlite_diffable.cli.dump(params, standalone_mode=False)
except click.exceptions.ClickException as e:
print("You must set all to True or specify a list of tables")
return False
return True
def objects(filepath, output='', array=False):
params = [filepath]
if output:
params += ['--output', output]
if array:
params.append('--array')
sqlite_diffable.cli.objects(params, standalone_mode=False)