Skip to content

Possible issue with 3.1.0 and sqlacodegen[geoalchemy2] #423

@benbenz

Description

@benbenz

Things to check first

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

Sqlacodegen version

3.1.0

SQLAlchemy version

2.0.41

RDBMS vendor

PostgreSQL

What happened?

I have (unknowingly) upgraded to the latest version of sqlacodegen after a pip re-install and suddenly my export script was not working anymore.
Doing a little bit of debugging it seems sqlalchemy was throwing from type_api.py line 643.

    @property
    def python_type(self) -> Type[Any]:
        """Return the Python type object expected to be returned
        by instances of this type, if known.

        Basically, for those types which enforce a return type,
        or are known across the board to do such for all common
        DBAPIs (like ``int`` for example), will return that type.

        If a return type is not defined, raises
        ``NotImplementedError``.

        Note that any type also accommodates NULL in SQL which
        means you can also get back ``None`` from any type
        in practice.

        """
        raise NotImplementedError()

After checking further, it seems it is a POINT type that is throwing off sqlacodegen.

After rollback to 3.0.0, everything goes back to normal.

Let me know if you need more info.

Database schema for reproducing the bug

CREATE TABLE public.geo_table (
	id serial4 NOT NULL,
	point public.geometry(point, 4326) NULL,
	polygon public.geometry(polygon, 4326) NULL,
	CONSTRAINT geo_table_pkey PRIMARY KEY (_id)
);

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions