LogoLogo
DoltHubBlogDiscordGitHubDolt
  • Introduction
    • What Is Dolt?
    • Installation
      • Linux
      • Windows
      • Mac
      • Build from Source
      • Application Server
      • Docker
      • Upgrading
    • Getting Started
      • Version Controlled Database
      • Git For Data
      • Versioned MySQL Replica
    • Use Cases
      • Data Sharing
      • Data and Model Quality Control
      • Manual Data Curation
      • Version Control for your Application
      • Versioned MySQL Replica
      • Audit
      • Configuration Management
      • Offline First
  • Concepts
    • Dolt
      • Git
        • Commits
        • Log
        • Diff
        • Branch
        • Merge
        • Conflicts
        • Remotes
        • Working Set
      • SQL
        • Databases
        • Schema
        • Tables
        • Primary Keys
        • Types
        • Indexes
        • Views
        • Constraints
        • Triggers
        • Procedures
        • Users/Grants
        • Transactions
        • System Variables
      • RDBMS
        • Server
        • Backups
        • Replication
    • DoltHub/DoltLab
      • Permissions
      • Pull Requests
      • Issues
      • Forks
  • SQL Reference
    • Running the Server
      • Configuration
      • Access Management
      • Branch Permissions
      • Backups
      • Garbage Collection
      • Metrics
      • Replication
      • Troubleshooting
    • Version Control Features
      • Using Branches
      • Merges
      • Querying History
      • Using Remotes
      • Procedures
      • Functions
      • System Tables
      • System Variables
      • Saved Queries
    • SQL Language Support
      • Data Description
      • Expressions, Functions, Operators
      • Supported Statements
      • MySQL Information Schema
      • Collations and Character Sets
      • System Variables
      • Miscellaneous
    • Supported Clients
      • Programmatic
      • SQL Editors
    • Benchmarks and Metrics
      • Correctness
      • Latency
      • Import
  • CLI Reference
    • Commands
    • Git Comparison
  • Architecture
    • Overview
    • Storage Engine
      • Commit Graph
      • Prolly Trees
      • Block Store
    • SQL
      • Go MySQL Server
      • Vitess
  • Guides
    • Cheat Sheet
    • Contributing
      • dolt
      • go-mysql-server
    • MySQL to Dolt Replication
    • Importing Data
    • Integrations
  • Other
    • FAQ
    • Roadmap
    • Versioning
  • Products
    • Hosted Dolt
      • Getting Started
      • Notable Features
      • SQL Workbench
      • Cloning a Hosted Database
      • Using DoltHub as a Remote
      • Infrastructure
    • DoltHub
      • Data Sharing
      • API
        • Authentication
        • SQL
        • CSV
        • Database
        • Hooks
      • Continuous Integration
        • Getting Started
        • Workflow Reference
      • Transform File Uploads
      • Workspaces
    • DoltLab
    • Dolt Workbench
    • DoltgreSQL
Powered by GitBook
On this page
  • Find data on DoltHub
  • Clone data locally
  • Make some changes
  • Fork the database on DoltHub
  • Setup your clone as a remote
  • Dolt Login
  • Pushing changes to remote
  • Create a pull request to the parent database
  • Next Steps

Was this helpful?

Edit on GitHub
Export as PDF
  1. Products
  2. DoltHub

Data Sharing

PreviousDoltHubNextAPI

Last updated 1 year ago

Was this helpful?

Find data on DoltHub

Our on DoltHub lets you find public databases created by users in our community. You can easily share these databases and adopt them for your own use cases.

Clone data locally

% dolt clone dolthub/corona-virus
cloning https://doltremoteapi.dolthub.com/dolthub/corona-virus
16,690 of 16,690 chunks complete. 0 chunks being downloaded currently.

% cd corona-virus

Make some changes

Once you've cloned a database from DoltHub, you can use the SQL shell to make a change to the data. We're going to add a row to the cases table on a new branch:

% dolt checkout -b add-new-case
Switched to branch 'add-new-case'

% dolt sql
# Welcome to the DoltSQL shell.
# Statements must be terminated with ';'.
# "exit" or "quit" (or Ctrl-D) to exit.
corona_virus> insert into cases (observation_time, place_id, confirmed_count, recovered_count, death_count) values("2021-12-07", 39, 400, 100, 3);
Query OK, 1 row affected
corona_virus> exit;
Bye
% dolt diff
diff --dolt a/cases b/cases
--- a/cases @ ullgt5s1i14g1vgndmuhek3269fjsvbc
+++ b/cases @ 3tfb3onk0r7i13hq1aohqj55lnsft912
+-----+---------------------+----------+-----------------+-----------------+-------------+
|     | observation_time    | place_id | confirmed_count | recovered_count | death_count |
+-----+---------------------+----------+-----------------+-----------------+-------------+
|  +  | 2021-12-07 00:00:00 | 39       | 400             | 100             | 3           |
+-----+---------------------+----------+-----------------+-----------------+-------------+

If the change looks good we add the table and commit:

% dolt add cases && dolt commit -m "Add new case for today"
commit pk9fei8l35php871j2gptaaa92v0e324
Author: Taylor Bantle <taylor@liquidata.co>
Date:   Tue Dec 07 11:43:56 -0800 2021

	Add new case for today

Fork the database on DoltHub

Now that we've made a change locally using Dolt, we want to push the change back to DoltHub so that it can be incorporated into the database.

Since we don't have write permissions to dolthub/corona-virus, we need to fork it to our own namespace. This is easily done using the fork button:

Now we have a database in our namespace that we can write to (taylor/corona-virus).

Setup your clone as a remote

Now that we have a fork of the original database, we need to add a remote to our locally cloned database.

% dolt remote add taylor taylor/corona-virus
% dolt remote
origin
taylor

We now have two remotes: origin which refers to the dolthub/corona-virus database on DoltHub, and taylor which refers to the fork taylor/corona-virus on DoltHub.

Dolt Login

Before we can push changes to our remote, we need to log in to Dolt so that it can recognize DoltHub as the remote database. First, run the dolt login command:

% dolt login
Credentials created successfully.
pub key: <some hash>
/Users/taylor/.dolt/creds/<another hash>.jwk
Opening a browser to:
	https://dolthub.com/settings/credentials#<some hash>
Please associate your key with your account.
Checking remote server looking for key association.

This will open your browser to the credentials settings page with the hash from above populated in the "Public key" field. Add a name for the token and click Create:

You should see this message if it was successful:

Key successfully associated with user: taylor email taylor@dolthub.com

You are now logged in and can push data to DoltHub.

Pushing changes to remote

We want to push the new branch we made changes to locally to the remote fork.

% dolt push taylor add-new-case
| Tree Level: 1, Percent Buffered: 0.00%, Files Written: 0, Files Uploaded: 1, Current Upload Speed: 22 kB/s

When you navigate to the fork on DoltHub, you'll see the new branch in the branch selector dropdown on the left:

Create a pull request to the parent database

To create a pull request, we first navigate to the parent database. In the "Pull Requests" tab click on the "Create Pull Request" button. Choose your fork as the "From database" and add a title and description.

Next Steps

The database owner can now view your changes and request updates if needed. You can make changes to your pull request by creating a new commit with a change on the same branch and pushing again. Once the owner is satisfied with the change they can decide to merge the pull request, which would update the parent database's main branch.

See an interesting database you'd like to make changes to? Get the database locally with just one command (assuming you have ), which is found on every database page:

We are going to use the database as an example

You can see how the insert query changed the cases table by viewing the :

In order to incorporate this change into the parent database (dolthub/corona-virus), we need to create a . A pull request is a way to propose changes to a database and discuss these changes with the database owners.

Dolt installed
dolthub/corona-virus
diff
pull request
discover page