Skip to content

bug: 'str' object has no attribute 'name' #11019

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

Open
1 task done
nextchamp-saqib opened this issue Mar 19, 2025 · 0 comments
Open
1 task done

bug: 'str' object has no attribute 'name' #11019

nextchamp-saqib opened this issue Mar 19, 2025 · 0 comments
Labels
bug Incorrect behavior inside of ibis

Comments

@nextchamp-saqib
Copy link
Contributor

What happened?

import ibis

db = ibis.postgres.connect(
		host="localhost",
		port=5432,
		user="p_user",
		password="frappe",
		database="postgres",
)

db.sql("SELECT * FROM pg_user").execute()

Error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 11
      1 import ibis
      3 db = ibis.postgres.connect(
      4 		host="localhost",
      5 		port=5432,
   (...)
      8 		database="postgres",
      9 )
---> 11 db.sql("SELECT * FROM pg_user").execute()

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/sql/__init__.py:176, in SQLBackend.sql(self, query, schema, dialect)
    174 query = self._transpile_sql(query, dialect=dialect)
    175 if schema is None:
--> 176     schema = self._get_schema_using_query(query)
    177 return ops.SQLQueryResult(query, ibis.schema(schema), self).to_expr()

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/postgres/__init__.py:574, in Backend._get_schema_using_query(self, query)
    572     pass
    573 try:
--> 574     return self.get_schema(name)
    575 finally:
    576     with self._safe_raw_sql(drop_stmt):

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/postgres/__init__.py:552, in Backend.get_schema(self, name, catalog, database)
    548 if not rows:
    549     raise com.IbisError(f"Table not found: {name!r}")
    551 return sch.Schema(
--> 552     {
    553         col: type_mapper.from_string(typestr, nullable=nullable)
    554         for col, typestr, nullable in rows
    555     }
    556 )

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/postgres/__init__.py:553, in <dictcomp>(.0)
    548 if not rows:
    549     raise com.IbisError(f"Table not found: {name!r}")
    551 return sch.Schema(
    552     {
--> 553         col: type_mapper.from_string(typestr, nullable=nullable)
    554         for col, typestr, nullable in rows
    555     }
    556 )

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/sql/datatypes.py:476, in PostgresType.from_string(cls, text, nullable)
    473 if text.lower().startswith("vector"):
    474     text = "vector"
--> 476 return super().from_string(text, nullable=nullable)

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/sql/datatypes.py:205, in SqlglotType.from_string(cls, text, nullable)
    203     return dt.unknown
    204 else:
--> 205     return cls.to_ibis(sgtype, nullable=nullable)

File ~/frappe/bench-v13/env/lib/python3.10/site-packages/ibis/backends/sql/datatypes.py:173, in SqlglotType.to_ibis(cls, typ, nullable)
    170     typecode = typ.this
    172 print(typecode) # -> OID
--> 173 if method := getattr(cls, f"_from_sqlglot_{typecode.name}", None):
    174     dtype = method(*typ.expressions)
    175 elif (known_typ := _from_sqlglot_types.get(typecode)) is not None:

AttributeError: 'str' object has no attribute 'name'

What version of ibis are you using?

9.5.0

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

Postgres

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nextchamp-saqib nextchamp-saqib added the bug Incorrect behavior inside of ibis label Mar 19, 2025
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: backlog
Development

No branches or pull requests

1 participant