Skip to content
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

bug: AttributeError: module 'sqlglot.expressions' has no attribute 'Median' #10738

Closed
1 task done
christophediprima opened this issue Jan 28, 2025 · 2 comments
Closed
1 task done
Labels
bug Incorrect behavior inside of ibis

Comments

@christophediprima
Copy link

What happened?

I wanted to use ibis.cases so I moved to latest version 10.0.0.dev490 prerelease.

Since then I have an issue using connect.

I tried with duckdb and pyspark and have the same issue.

con = ibis.pyspark.connect() OR con = ibis.duckdb.connect()

Result in following error:

AttributeError: module 'sqlglot.expressions' has no attribute 'Median'

What version of ibis are you using?

10.0.0.dev490

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

DuckDB or PySpark

Relevant log output

Traceback (most recent call last):
  File "/Volumes/case-sensitive/lab/src/test.DIP/ibis/./transfrom.py", line 9, in <module>
    con = ibis.pyspark.connect(session)
          ^^^^^^^^^^^^
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/__init__.py", line 142, in __getattr__
    return load_backend(name)
           ^^^^^^^^^^^^^^^^^^
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/__init__.py", line 82, in load_backend
    module = entry_point.load()
             ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/pyspark/__init__.py", line 17, in <module>
    import ibis.backends.sql.compilers as sc
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/compilers/__init__.py", line 25, in <module>
    from ibis.backends.sql.compilers.athena import AthenaCompiler
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/compilers/athena.py", line 8, in <module>
    from ibis.backends.sql.compilers.trino import TrinoCompiler
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/compilers/trino.py", line 23, in <module>
    from ibis.backends.sql.dialects import Trino
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/dialects.py", line 27, in <module>
    class ClickHouse(_ClickHouse):
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/dialects.py", line 28, in ClickHouse
    class Generator(_ClickHouse.Generator):
  File "/Volumes/case-sensitive/lab/.lab/python.environments/ibis/lib/python3.11/site-packages/ibis/backends/sql/dialects.py", line 34, in Generator
    sge.Median: rename_func("median"),
    ^^^^^^^^^^
AttributeError: module 'sqlglot.expressions' has no attribute 'Median'

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cpcloud
Copy link
Member

cpcloud commented Jan 28, 2025

Thanks for the issue!

Can you try upgrading your sqlglot version to the latest release?

@christophediprima
Copy link
Author

Thanks a lot! Fixed the issue 👍

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
Status: done
Development

No branches or pull requests

2 participants