-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document data docker schema update mode #527
Closed
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,64 @@ | ||
--- | ||
layout: default | ||
title: Update your database schema | ||
nav_order: 9 | ||
parent: Build your own Data Commons | ||
--- | ||
|
||
{:.no_toc} | ||
# Update your database schema | ||
|
||
While starting Data Commons services, you may see an error that starts with `SQL schema check failed`. This means your database schema must be updated for compatibility with the latest Data Commons services. | ||
|
||
You can update your database by running a data management job with the environment variable `SCHEMA_UPDATE_ONLY` set to `true`. This will alter your database without modifying already-imported data. | ||
|
||
Running a data management job in the default mode will also update the database schema, but may take longer since it fully re-imports your custom data. | ||
|
||
Once your database is updated, starting Data Commons services should succeed. | ||
|
||
This page contains detailed instructions for passing `SCHEMA_UPDATE_ONLY` to the data management container using various workflows. | ||
|
||
* TOC | ||
{:toc} | ||
|
||
## Local data management job with local SQLite database | ||
|
||
Add `-e SCHEMA_UPDATE_ONLY=true` to the Docker run command for the data management container (the first command in [this doc section](/custom_dc/custom_data.html#docker-data){: target="_blank"}): | ||
|
||
<pre> | ||
docker run \ | ||
--env-file $PWD/custom_dc/env.list \ | ||
-v <var>INPUT_DIRECTORY</var>:<var>INPUT_DIRECTORY</var> \ | ||
-v <var>OUTPUT_DIRECTORY</var>:<var>OUTPUT_DIRECTORY</var> \ | ||
<b>-e SCHEMA_UPDATE_ONLY=true</b> \ | ||
gcr.io/datcom-ci/datacommons-data:stable | ||
</pre> | ||
|
||
## Cloud Run data management job | ||
|
||
Run your existing Cloud Run job with an environment variable override. | ||
|
||
1. Go to [https://console.cloud.google.com/run/jobs](https://console.cloud.google.com/run/jobs){: target="_blank"} for your project. | ||
1. From the list of jobs, click the link of the "datacommons-data" job. This should be a job that uses the `stable` or `latest` version of the image hosted at gcr.io/datcom-ci/datacommons-data:stable. | ||
1. Next to Execute, use the dropdown to find the option to **Execute with overrides**. | ||
1. Use the **Add variable** button to set a variable with name `SCHEMA_UPDATE_ONLY` and value `true`. | ||
1. Click **Execute**. | ||
1. It should only take a few minutes for the job to run. You can click the **Logs** tab to view the progress. | ||
|
||
|
||
## (Advanced) Local data management job with Cloud SQL | ||
|
||
If you followed [these instructions](/custom_dc/data_cloud.html#run-local){: target="_blank"} to load data from your local machine into a Cloud SQL database, add `-e SCHEMA_UPDATE_ONLY=true` to the Docker run command from the final step: | ||
|
||
<pre> | ||
docker run \ | ||
--env-file $PWD/custom_dc/env.list \ | ||
-v <var>INPUT_DIRECTORY</var>:<var>INPUT_DIRECTORY</var> \ | ||
-v <var>OUTPUT_DIRECTORY</var>:<var>OUTPUT_DIRECTORY</var> \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=/gcp/creds.json \ | ||
-v $HOME/.config/gcloud/application_default_credentials.json:/gcp/creds.json:ro \ | ||
<b>-e SCHEMA_UPDATE_ONLY=true</b> \ | ||
gcr.io/datcom-ci/datacommons-data:<var>VERSION</var> | ||
</pre> | ||
|
||
Substitute the `VERSION` that matches the services container image which failed with a schema check error (typically either `stable` or `latest`). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May need to be updated based on what we decide in https://github.com/datacommonsorg/website/pull/4686/files#r1815646141
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.