Skip to content

bug: mssql insert throw table not found error if specify schema and database #10281

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

Closed
1 task done
ruiyang2015 opened this issue Oct 7, 2024 · 2 comments · Fixed by #10285
Closed
1 task done

bug: mssql insert throw table not found error if specify schema and database #10281

ruiyang2015 opened this issue Oct 7, 2024 · 2 comments · Fixed by #10285
Labels
bug Incorrect behavior inside of ibis
Milestone

Comments

@ruiyang2015
Copy link

What happened?

for following example:

c = ibis.mssql.connect(...)
df = pd.DataFrame.from_dict({'val': [1, 2, 3]})
c.insert('t', df, database='db.mydbo')

getting an exception like this:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ruiyang/Go/src/github.com/ascend-io/ascend-core/.venv/lib/python3.11/site-packages/ibis/backends/sql/__init__.py", line 407, in insert
    query = self._build_insert_from_table(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ruiyang/Go/src/github.com/ascend-io/ascend-core/.venv/lib/python3.11/site-packages/ibis/backends/sql/__init__.py", line 422, in _build_insert_from_table
    target_cols = self.get_schema(target).keys()
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ruiyang/Go/src/github.com/ascend-io/ascend-core/.venv/lib/python3.11/site-packages/ibis/backends/mssql/__init__.py", line 281, in get_schema
    raise com.IbisError(f"Table not found: {fqn}")
ibis.common.exceptions.IbisError: Table not found: t

What version of ibis are you using?

9.5.0

What backend(s) are you using, if any?

mssql

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ruiyang2015 ruiyang2015 added the bug Incorrect behavior inside of ibis label Oct 7, 2024
@ruiyang2015
Copy link
Author

the exception is from the base class of sql backend, and it seems a bug of getting the query schema,
the get_schema is invoked with only table name, without passing through the database and catalog arguments from the insert call to it.

@ruiyang2015
Copy link
Author

looks like there is already a draft pr to address this issue:
#9821
but it seems no further progress on it, can anyone prioritize it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant