Python Quickstart
Refer to Python guides to learn more.

CLI:

1
$ sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash'
2
$ pip install --user doltcli
3
$ python
4
>>> import doltcli as dolt
5
>>> db = dolt.Dolt.clone("max-hoffman/qm9")
6
>>> db
7
Dolt(repo_dir='/Users/max-hoffman/qm9', print_output=False)
8
>>> db.sql("select id, elements from qm9_features limit 1", result_format="json")
9
{'rows': [{'id': 'gdb_17152', 'elements': [7, 6, 6, 6, 6, 6, 8, 6, 1, 1, 1, 1, 1]}]}
Copied!

Server

Start server:
1
$ sudo bash -c 'curl -L https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash'
2
$ dolt clone max-hoffman/qm9
3
cloning https://doltremoteapi.dolthub.com/max-hoffman/qm9
4
50,437 of 50,437 chunks complete. 0 chunks being downloaded currently.
5
$ cd qm9
6
$ dolt sql-server -l trace --max-connections 10
Copied!
Connect to server with client:
1
$ python
2
>>> from sqlalchemy import create_engine
3
>>> engine = create_engine("mysql+pymysql://[email protected]/qm9")
4
>>> with engine.begin() as connection:
5
... conn.execute("select id, elements from qm9_features limit 1").fetchone()
6
('gdb_107528', '[8, 6, 6, 6, 6, 6, 6, 6, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1]')
Copied!
Last modified 3mo ago
Export as PDF
Copy link
Contents
CLI:
Server