visidata icon indicating copy to clipboard operation
visidata copied to clipboard

vsdql related errors on load and `&`

Open reagle opened this issue 2 months ago • 1 comments

I was trying to run a simple vsdql example, but ran into some problems; not sure what they mean -- and I can work with the file okay without -f vdsql.

  • macOS 14.4.1 23E224 arm64
  • saul.pw/VisiData v3.0.2
wget https://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip
unzip chinook.zip
vd -f vdsql chinook.db

On load:

Traceback (most recent call last):
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sqlite/__init__.py", line 168, in _parse_type
out = self._type_map[typ]
~~~~~~~~~~~~~~^^^^^
KeyError: 'datetime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/threads.py", line 220, in _toplevelTryFunc
t.status = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/sheets.py", line 260, in reload
self.loader()
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/sheets.py", line 285, in loader
for r in self.iterload():
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/vdsql/ibis.py", line 67, in iterload
tbl = self.tbl = con.table(tblname)
^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sql/__init__.py", line 137, in table
table_schema = self.get_schema(name, catalog=catalog, database=database)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sqlite/__init__.py", line 240, in get_schema
return self._inspect_schema(cur, table_name, database)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sqlite/__init__.py", line 207, in _inspect_schema
name: self._parse_type(typ, nullable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sqlite/__init__.py", line 170, in _parse_type
return self.compiler.type_mapper.from_string(typ, nullable=nullable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sql/datatypes.py", line 196, in from_string
return cls.to_ibis(sgtype, nullable=nullable)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/backends/sql/datatypes.py", line 174, in to_ibis
dtype = _from_sqlglot_types[typecode](nullable=cls.default_nullable)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: <Type.DATETIME: 'DATETIME'>

Ignoring, and trying to merge albums and artists:

Traceback (most recent call last):
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/vdsql/ibis.py", line 256, in get_ibis_col
r = query.get_column(col.ibis_name)
^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/expr/types/relations.py", line 844, in __getattr__
raise AttributeError(f"'Table' object has no attribute {key!r}")
AttributeError: 'Table' object has no attribute 'get_column'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/basesheet.py", line 211, in execCommand
escaped = super().execCommand2(cmd, vdglobals=vdglobals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/extensible.py", line 79, in wrappedfunc
r = oldfunc(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/basesheet.py", line 76, in execCommand2
exec(code, vdglobals, LazyChainMap(vd, self))
File "join-selected", line 1, in <module>
'VisiData: a curses interface for exploring and arranging tabular data'
^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/vdsql/ibis.py", line 235, in openJoin
preds = [(a.ibis_col == b.ibis_col) for a, b in zip(self.keyCols, other.keyCols)]
^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/visidata/extensible.py", line 108, in dofunc
return func(self)
^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/vdsql/ibis.py", line 243, in ibis_col
return col.get_ibis_col(col.sheet.query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/vdsql/ibis.py", line 258, in get_ibis_col
r = query.get_column(col.name)
^^^^^^^^^^^^^^^^
File "/Users/reagle/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ibis/expr/types/relations.py", line 844, in __getattr__
raise AttributeError(f"'Table' object has no attribute {key!r}")
AttributeError: 'Table' object has no attribute 'get_column'

reagle avatar May 02 '24 12:05 reagle