-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command line tool for updating Murfey database tables (#205)
- Loading branch information
1 parent
d0e7420
commit c5b3555
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import argparse | ||
import os | ||
|
||
from murfey.util.db import clear, setup | ||
|
||
|
||
def run(): | ||
parser = argparse.ArgumentParser( | ||
description="Generate the necessary tables for the Murfey database" | ||
) | ||
|
||
parser.add_argument( | ||
"--no-clear", | ||
dest="clear", | ||
default=True, | ||
action="store_false", | ||
help="Do not clear current database tables before creating specified tables", | ||
) | ||
parser.add_argument( | ||
"-m", | ||
"--microscope", | ||
dest="microscope", | ||
type=str, | ||
default="", | ||
help="Microscope as specified in the Murfey machine configuration", | ||
) | ||
|
||
args = parser.parse_args() | ||
if args.microscope: | ||
os.environ["BEAMLINE"] = args.microscope | ||
|
||
from murfey.server.murfey_db import url | ||
|
||
if args.clear: | ||
clear(url()) | ||
setup(url()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters