doltpy icon indicating copy to clipboard operation
doltpy copied to clipboard

`DoltSQLServerContext` connection fails when there are unstaged changes

Open alkamid opened this issue 2 years ago • 0 comments

$ dolt status
On branch test_data_types
Untracked files:
  (use "dolt add <table|doc>" to include in what will be committed)
        new table:      mytable
with DoltSQLServerContext(dolt, ServerConfig(user="root", password="")) as doltsql:
    df = doltsql.read_pandas("mytable")

ValueError                                Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 with DoltSQLServerContext(dolt, ServerConfig(user="root", password="")) as doltsql:
      2     df = doltsql.read_pandas("mytable")

File ~/.cache/pypoetry/virtualenvs/science-s3M63NV5-py3.9/lib/python3.9/site-packages/doltpy/sql/sql.py:368, in DoltSQLServerContext.__enter__(self)
    365 def __enter__(self):
    366     if not self.dolt.status().is_clean:
    367         # TODO better error messages
--> 368         raise ValueError("DoltSQLServerManager does not support ")
    369     if self.server_config.branch:
    370         current_branch, _ = self.dolt.branch()

After committing changes:

$ dolt status
On branch test_data_types
nothing to commit, working tree clean

it's working fine.

alkamid avatar Jun 01 '22 10:06 alkamid