Skip to content

CatalogException: Catalog Error: Scalar Function with name "st_point" is not in the catalog, but it exists in the spatial extension #175

@HealthyPear

Description

@HealthyPear

Describe the bug

Even after doing starplot setup --install-big-sky I get this error when asking for a list of bright stars using the SQL query,

---------------------------------------------------------------------------
CatalogException                          Traceback (most recent call last)
Cell In[2], line 1
----> 1 bright_stars = Star.find(sql="select * from _ where magnitude < 4")

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/starplot/models/star.py:129, in Star.find(cls, where, sql, catalog)
    110 @classmethod
    111 def find(
    112     cls,
   (...)    115     catalog: StarCatalog = StarCatalog.BIG_SKY_MAG11,
    116 ) -> list["Star"]:
    117     """
    118     Find Stars
    119
   (...)    127
    128     """
--> 129     df = _load_stars(
    130         catalog=catalog,
    131         filters=where,
    132         sql=sql,
    133     ).to_pandas()
    135     return [from_tuple(s) for s in df.itertuples()]

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/starplot/data/stars.py:87, in load(extent, catalog, filters, sql)
     84     stars = stars.filter(*filters)
     86 if sql:
---> 87     result = stars.alias("_").sql(sql).select("sk").execute()
     88     skids = result["sk"].to_list()
     89     stars = stars.filter(_.sk.isin(skids))

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/ibis/expr/types/relations.py:3568, in Table.sql(self, query, dialect)
   3565     name = util.gen_name("sql_query")
   3566     expr = self
-> 3568 schema = backend._get_sql_string_view_schema(name=name, table=expr, query=query)
   3569 node = ops.SQLStringView(child=self.op(), query=query, schema=schema)
   3570 return node.to_expr()

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/ibis/backends/sql/__init__.py:201, in SQLBackend._get_sql_string_view_schema(self, name, table, query)
    197 def _get_sql_string_view_schema(
    198     self, *, name: str, table: ir.Table, query: str
    199 ) -> sch.Schema:
    200     sql = self.compiler.add_query_to_expr(name=name, table=table, query=query)
--> 201     return self._get_schema_using_query(sql)

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/ibis/backends/duckdb/__init__.py:1741, in Backend._get_schema_using_query(self, query)
   1740 def _get_schema_using_query(self, query: str) -> sch.Schema:
-> 1741     with self._safe_raw_sql(f"DESCRIBE {query}") as cur:
   1742         rows = cur.fetch_arrow_table()
   1744     rows = rows.to_pydict()

File ~/Software/miniforge3/envs/starplot/lib/python3.13/contextlib.py:141, in _GeneratorContextManager.__enter__(self)
    139 del self.args, self.kwds, self.func
    140 try:
--> 141     return next(self.gen)
    142 except StopIteration:
    143     raise RuntimeError("generator didn't yield") from None

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/ibis/backends/duckdb/__init__.py:321, in Backend._safe_raw_sql(self, *args, **kwargs)
    319 @contextlib.contextmanager
    320 def _safe_raw_sql(self, *args, **kwargs):
--> 321     yield self.raw_sql(*args, **kwargs)

File ~/Software/miniforge3/envs/starplot/lib/python3.13/site-packages/ibis/backends/duckdb/__init__.py:93, in Backend.raw_sql(self, query, **kwargs)
     91 with contextlib.suppress(AttributeError):
     92     query = query.sql(dialect=self.name)
---> 93 return self.con.execute(query, **kwargs)

CatalogException: Catalog Error: Scalar Function with name "st_point" is not in the catalog, but it exists in the spatial extension.

Please try installing and loading the spatial extension:
INSTALL spatial;
LOAD spatial;

To Reproduce

from starplot import Star
bright_stars = Star.find(sql="select * from _ where magnitude < 4")

Expected behavior

Using starplot 0.16.4 I see

[Star(hip=32349, tyc=5949-2777-1, magnitude=-1.44, ra=101.2871, dec=-16.7161),
 Star(hip=30438, tyc=8534-2277-1, magnitude=-0.62, ra=95.988, dec=-52.6956),
 Star(hip=69673, tyc=1472-1436-1, magnitude=-0.05, ra=213.9153, dec=19.1824),
 Star(hip=71683, tyc=9007-5849-1, magnitude=-0.01, ra=219.9024, dec=-60.8339),
 Star(hip=24608, tyc=3358-3141-1, magnitude=0.08, ra=79.1724, dec=45.998),
 Star(hip=24436, tyc=5331-1752-1, magnitude=0.18, ra=78.6345, dec=-8.2016),
...]

Environment Details (please complete the following information):

  • Starplot version 0.16.6
  • Python version 3.13.3
  • Matplotlib version 3.10.3
  • OS: [e.g. macOS, Ubuntu, Windows, etc] macos 15.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions