You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "./manage.py", line 21, in <module>
main()
File "./manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 1380, in run_from_argv
super().run_from_argv(argv)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 1367, in execute
super().execute(*args, **options)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/utils.py", line 62, in inner
ret = func(self, *args, **kwargs)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 1360, in handle
sqldiff_instance.find_differences()
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 676, in find_differences
self.find_field_type_differ(meta, table_description, table_name)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 550, in find_field_type_differ
db_type = self.get_field_db_type(description, field, table_name)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 1182, in get_field_db_type
db_type = super().get_field_db_type(description, field, table_name)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django_extensions/management/commands/sqldiff.py", line 342, in get_field_db_type
reverse_type, geo_params = self.introspection.get_geometry_type(table_name, geo_col)
File "/Users/dana/.local/share/virtualenvs/lucidgreen-consumer-jem90h-L/lib/python3.8/site-packages/django/contrib/gis/db/backends/postgis/introspection.py", line 43, in get_geometry_type
""", (table_name, description.name))
AttributeError: 'str' object has no attribute 'name'
Digging into the code, there is a call to get_geometry_type from sqldiff.py (L338):
if reverse_type == 'GeometryField':
geo_col = description[0]
# Getting a more specific field type and any additional parameters
# from the `get_geometry_type` routine for the spatial backend.
reverse_type, geo_params = self.introspection.get_geometry_type(table_name, geo_col)
if geo_params:
kwargs.update(geo_params)
reverse_type = 'django.contrib.gis.db.models.fields.%s' % reverse_type
get_geometry_type seems to want to be called with table_name and description, not geo_col.
If I change the call to get_geometry_type to take description, sqldiff command seems to work.
This seems like a simple change to make, but I'm curious if this is something other users have seen.
The text was updated successfully, but these errors were encountered:
Not sure if this is a bug, but perhaps, and I'm happy to help debug, but here goes:
When I run
sqldiff
on a PG 13 database with PostGIS installed (on Mac OS X big sur) that has a geometry field:I get this error:
Digging into the code, there is a call to
get_geometry_type
fromsqldiff.py
(L338):get_geometry_type
seems to want to be called withtable_name
anddescription
, notgeo_col
.If I change the call to
get_geometry_type
to takedescription
,sqldiff
command seems to work.This seems like a simple change to make, but I'm curious if this is something other users have seen.
The text was updated successfully, but these errors were encountered: