Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cannot use when GIS Polygon Columns are present #1850

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
FilippoPagano opened this issue Nov 22, 2023 · 2 comments
Open

Cannot use when GIS Polygon Columns are present #1850

FilippoPagano opened this issue Nov 22, 2023 · 2 comments

Comments

@FilippoPagano
Copy link

FilippoPagano commented Nov 22, 2023

When I run python manage.py sqldiff app I get AttributeError: 'str' object has no attribute 'name' because I have PostGIS Polygon columns in my postgres database.

This one might be a bug in django GIS, but I'm not sure. (File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\contrib\gis\db\backends\postgis\introspection.py", line 51, in get_geometry_type (table_name, description.name))

Complete stack trace:
PS C:\Users\USER\workspace\urbanfarmer\django-urban-farmer> python manage.py sqldiff app Traceback (most recent call last): File "C:\Users\USER\workspace\urbanfarmer\django-urban-farmer\manage.py", line 19, in <module> main() File "C:\Users\USER\workspace\urbanfarmer\django-urban-farmer\manage.py", line 16, in main execute_from_command_line(sys.argv) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line utility.execute() File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\core\management\__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 1402, in run_from_argv super().run_from_argv(argv) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\core\management\base.py", line 412, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 1389, in execute super().execute(*args, **options) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\core\management\base.py", line 458, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\utils.py", line 62, in inner ret = func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 1382, in handle sqldiff_instance.find_differences() File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 694, in find_differences self.find_field_type_differ(meta, table_description, table_name) File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 568, in find_field_type_differ db_type = self.get_field_db_type(description, field, table_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 1204, in get_field_db_type db_type = super().get_field_db_type(description, field, table_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django_extensions\management\commands\sqldiff.py", line 343, in get_field_db_type reverse_type, geo_params = self.introspection.get_geometry_type(table_name, geo_col) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\USER\AppData\Roaming\Python\Python311\site-packages\django\contrib\gis\db\backends\postgis\introspection.py", line 51, in get_geometry_type (table_name, description.name), ^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'name'

@julopezc-acciona
Copy link

julopezc-acciona commented Aug 28, 2024

Check out #1883 and see if it solves the issue
#1860 is a better solution

@FilippoPagano
Copy link
Author

Duplicate of #1652

@FilippoPagano FilippoPagano reopened this Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants