Skip to content

Instantly share code, notes, and snippets.

@amoeba
Created November 14, 2024 22:07
Show Gist options
  • Save amoeba/307ef7de691df21b73d353dd13cc6bd0 to your computer and use it in GitHub Desktop.
Save amoeba/307ef7de691df21b73d353dd13cc6bd0 to your computer and use it in GitHub Desktop.
.venv ❯ ipython
Python 3.12.7 (main, Oct 16 2024, 07:12:08) [Clang 18.1.8 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.29.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import ibis
In [2]: ibis.__version__
Out[2]: '9.5.0'
In [3]: con = ibis.postgres.connect()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[3], line 1
----> 1 con = ibis.postgres.connect()
File ~/src/ibis-project/ibis/ibis/__init__.py:142, in __getattr__(name)
140 return null() # noqa: F405
141 else:
--> 142 return load_backend(name)
File ~/src/ibis-project/ibis/ibis/__init__.py:82, in load_backend(name)
80 (entry_point,) = entry_points
81 try:
---> 82 module = entry_point.load()
83 except ImportError as exc:
84 raise ImportError(
85 f"Failed to import the {name} backend due to missing dependencies.\n\n"
86 f"You can pip or conda install the {name} backend as follows:\n\n"
87 f' python -m pip install -U "ibis-framework[{name}]" # pip install\n'
88 f" conda install -c conda-forge ibis-{name} # or conda install"
89 ) from exc
File ~/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/importlib/metadata/__init__.py:205, in EntryPoint.load(self)
200 """Load the entry point from its definition. If only a module
201 is indicated by the value, return that module. Otherwise,
202 return the named object.
203 """
204 match = self.pattern.match(self.value)
--> 205 module = import_module(match.group('module'))
206 attrs = filter(None, (match.group('attr') or '').split('.'))
207 return functools.reduce(getattr, attrs, module)
File ~/.local/share/uv/python/cpython-3.12.7-macos-aarch64-none/lib/python3.12/importlib/__init__.py:90, in import_module(name, package)
88 break
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)
File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level)
File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:1331, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:935, in _load_unlocked(spec)
File <frozen importlib._bootstrap_external>:995, in exec_module(self, module)
File <frozen importlib._bootstrap>:488, in _call_with_frames_removed(f, *args, **kwds)
File ~/src/ibis-project/ibis/ibis/backends/postgres/__init__.py:16
13 from pandas.api.types import is_float_dtype
15 import ibis
---> 16 import ibis.backends.sql.compilers as sc
17 import ibis.common.exceptions as com
18 import ibis.common.exceptions as exc
File ~/src/ibis-project/ibis/ibis/backends/sql/compilers/__init__.py:25
3 __all__ = [
4 "BigQueryCompiler",
5 "ClickHouseCompiler",
(...)
21 "TrinoCompiler",
22 ]
24 from ibis.backends.sql.compilers.bigquery import BigQueryCompiler
---> 25 from ibis.backends.sql.compilers.clickhouse import ClickHouseCompiler
26 from ibis.backends.sql.compilers.databricks import DatabricksCompiler
27 from ibis.backends.sql.compilers.datafusion import DataFusionCompiler
File ~/src/ibis-project/ibis/ibis/backends/sql/compilers/clickhouse.py:17
15 from ibis.backends.sql.compilers.base import NULL, STAR, AggGen, SQLGlotCompiler
16 from ibis.backends.sql.datatypes import ClickHouseType
---> 17 from ibis.backends.sql.dialects import ClickHouse
19 if TYPE_CHECKING:
20 from collections.abc import Iterator, Mapping
File ~/src/ibis-project/ibis/ibis/backends/sql/dialects.py:27
23 from sqlglot.dialects.dialect import rename_func
24 from sqlglot.helper import find_new_name, seq_get
---> 27 class ClickHouse(_ClickHouse):
28 class Generator(_ClickHouse.Generator):
29 _ClickHouse.Generator.TRANSFORMS |= {
30 sge.ArraySize: rename_func("length"),
31 sge.ArraySort: rename_func("arraySort"),
(...)
34 sge.Median: rename_func("median"),
35 }
File ~/src/ibis-project/ibis/ibis/backends/sql/dialects.py:28, in ClickHouse()
27 class ClickHouse(_ClickHouse):
---> 28 class Generator(_ClickHouse.Generator):
29 _ClickHouse.Generator.TRANSFORMS |= {
30 sge.ArraySize: rename_func("length"),
31 sge.ArraySort: rename_func("arraySort"),
(...)
34 sge.Median: rename_func("median"),
35 }
37 def except_op(self, expression: sge.Except) -> str:
File ~/src/ibis-project/ibis/ibis/backends/sql/dialects.py:34, in ClickHouse.Generator()
28 class Generator(_ClickHouse.Generator):
29 _ClickHouse.Generator.TRANSFORMS |= {
30 sge.ArraySize: rename_func("length"),
31 sge.ArraySort: rename_func("arraySort"),
32 sge.LogicalAnd: rename_func("min"),
33 sge.LogicalOr: rename_func("max"),
---> 34 sge.Median: rename_func("median"),
35 }
37 def except_op(self, expression: sge.Except) -> str:
38 return f"EXCEPT{' DISTINCT' if expression.args.get('distinct') else ' ALL'}"
AttributeError: module 'sqlglot.expressions' has no attribute 'Median'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment