Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15277 closed Bug (fixed)

TypeError in ogrinspect geodjango gis

Reported by: willinoed@… Owned by: willi
Component: GIS Version: 1.2
Severity: Normal Keywords: ogrinspect, geodjango OFTTime TypeError
Cc: willi, john@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I got an error when using

python manage.py ogrinspect PG:"dbname='thedbname' host='localhost' port='5432' user='theuser' password='thepassword'" MyModel --layer=thelayer --mapping --multi

there is a table with a column of type "time" in the database and the error when running the command above:

File "PATH_TO_VENV\venv\Lib\site-packages\django\contrib\gis\utils\ogrinspect.py", line 195, in _ogrinspect
    raise TypeError('Unknown field type %s in %s' % (field_type, mfield))
TypeError: Unknown field type <class 'django.contrib.gis.gdal.field.OFTTime'> in
 thelayer_time

-->
the bug seems to be in ogrinspect.py line 192:

        elif field_type is OFTDate:

change:

        elif field_type is OFTTime:

Attachments (4)

15277.1.patch (1.2 KB) - added by jpaulett 3 years ago.
15277.2.patch (3.9 KB) - added by jpaulett 3 years ago.
Adds ogrinspect tests (though we are unable to currently generate a shapefile with a OGRTime field)
15277.3.patch (7.2 KB) - added by jbronn 3 years ago.
15277.4.patch (10.7 KB) - added by jpaulett 3 years ago.
Test TimeField by having GDAL inspect a geo database model

Download all attachments as: .zip

Change History (9)

comment:1 Changed 3 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by lrekucki

  • Severity set to Normal
  • Type set to Bug

Changed 3 years ago by jpaulett

comment:3 Changed 3 years ago by jpaulett

  • Cc john@… added
  • Easy pickings unset
  • Has patch set
  • UI/UX unset

Changed 3 years ago by jpaulett

Adds ogrinspect tests (though we are unable to currently generate a shapefile with a OGRTime field)

Changed 3 years ago by jbronn

Changed 3 years ago by jpaulett

Test TimeField by having GDAL inspect a geo database model

comment:4 Changed 3 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

In [16845]:

Fixed #15277 -- Cleaned up ogrinspect command, added tests and extended support beyond file-based OGR data sources. Thanks, willinoed for bug report and jpaulett for initial patch.

comment:5 Changed 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.