Skip to content

Commit

Permalink
added some handy scripts to export cells from psql pod in legacy db s…
Browse files Browse the repository at this point in the history
…chema [used in tinydb]
  • Loading branch information
AndyBRoswell committed Dec 8, 2024
1 parent bfc6f69 commit 83fcf1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$cwd = $PWD

$project_root = Resolve-Path "$PSScriptRoot/../../.."

$vreapi_pod_inf = kubectl get pod | sls '^vrepaas-vreapi-\w+-\w+'
Expand All @@ -19,6 +21,10 @@ $var[$off_DB_PASSWORD] = "export DB_PASSWORD=vrepaas"
$var > /tmp/export_VARS
kubectl cp /tmp/export_VARS "${vreapi_pod_name}:/tmp"
kubectl cp "$PSScriptRoot/export-from-psql-pod-in-legacy-db-schema.sh" "${vreapi_pod_name}:/tmp"

kubectl cp ~/NaaVRE/NaaVRE_db.json "${vreapi_pod_name}:/app"
kubectl exec -it $vreapi_pod_name -- bash "/tmp/export-from-psql-pod-in-legacy-db-schema.sh"

kubectl cp "${vreapi_pod_name}:/app/NaaVRE_db.json" $project_root/NaaVRE_db.json
kubectl cp "${vreapi_pod_name}:/app/NaaVRE_db.json" ~/NaaVRE/NaaVRE_db.json

cd $cwd
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ def handle(self, *args, **options):
match table:
case 'Cell':
queryset: QuerySet = Cell.objects.all()
print(f'Cell count: {queryset.count()}')
no: int = 1
cells: dict[str, dict] = {}
for cell in queryset:
serializer = CellSerializer(cell)
print(f'task_name: {cell.task_name}')
cells[str(no)] = serializer.data
no += 1
db_file: str = f'{common.project_root}/NaaVRE_db.json'
with open(db_file) as f:
db = json.load(f)
Expand Down

0 comments on commit 83fcf1b

Please sign in to comment.