qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.37k stars 2.98k forks source link

Python TypeError in DB manager when tables in Oracle database schema is read #57731

Open Bjoern-Rapp opened 3 months ago

Bjoern-Rapp commented 3 months ago

What is the bug or the crash?

2024-06-11T12:55:17     WARNING    Traceback (most recent call last):
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_model.py", line 452, in rowCount
              self._refreshIndex(parent, True)
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_model.py", line 501, in _refreshIndex
              if item.populate():
              ^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_model.py", line 231, in populate
              for t in self.getItemData().tables():
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_plugins\plugin.py", line 643, in tables
              return self.database().tables(self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_plugins\plugin.py", line 568, in tables
              tables = self.connector.getTables(schema.name if schema else None, sys_tables)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_plugins\oracle\connector.py", line 330, in getTables
              vectors = self.getVectorTables(schema)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_plugins\oracle\connector.py", line 624, in getVectorTables
              geomMultiTypes, multiSrids = self.getTableGeomTypes(
              ^^^^^^^^^^^^^^^^^^^^^^^
              File "C:\PROGRA~1/QGIS33~1.3/apps/qgis/./python/plugins\db_manager\db_plugins\oracle\connector.py", line 785, in getTableGeomTypes
              if int(row[0]) in list(OracleDBConnector.ORGeomTypes.keys()):
              ^^^^^^^^^^^
             TypeError: int() argument must be a string, a bytes-like object or a real number, not 'QVariant'

Steps to reproduce the issue

  1. Open the Database manager.
  2. Connect to a Oracle database.
  3. Try to list tables in a nonempty schema
  4. Wait while Qgis freezes for a moment
  5. Get a yellow Python error banner.

Versions

QGIS version 3.36.3-Maidenhead QGIS code revision 2df96554 Qt version 5.15.13 Python version 3.12.3 GDAL/OGR version 3.9.0 PROJ version 9.4.0 EPSG Registry database version v11.004 (2024-02-24) GEOS version 3.12.1-CAPI-1.18.1 SQLite version 3.45.1 PDAL version 2.6.3 PostgreSQL client version 16.2 SpatiaLite version 5.1.0 QWT version 6.2.0 QScintilla2 version 2.14.1 OS version Windows Server 2016 Version 1607

Active Python plugins db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.6 processing 2.12.99

Supported QGIS version

New profile

Additional context

No response

luigicc commented 1 day ago

same behavior here.

Plus: If I know that a certain table is present in the connection, I can create a query and it returns results. For example, the table TABLE1 exists in the database with the column COL1. If I create the query: select col1 from table1;

it returns all the expected results.

QGIS version 3.34.10-Prizren QGIS code revision 113de9e1
Qt version 5.15.13
Python version 3.12.5
GDAL/OGR version 3.9.2
PROJ version 9.4.0
EPSG Registry database version v11.004 (2024-02-24)
GEOS version 3.12.2-CAPI-1.18.2
SQLite version 3.45.1
PDAL version 2.6.3
PostgreSQL client version 16.2
SpatiaLite version 5.1.0
QWT version 6.2.0
QScintilla2 version 2.14.1
OS version Windows 11 Version 2009
       

Active Python plugins cartography_tools | 1.2.1 coordinate_capture | 0.2 coordinator | 0.4 DigitizingTools | 1.5.2 JSONEater-master | 0.3 latlontools | 3.7.0 layer_grid_view | 0.1 layer_tree_tools | 1.3.0 MemoryLayerSaver | 5.0.2 NNJoin | 3.1.3 numericalDigitize | 0.4.8 p190_import | 0.4 QuickWKT | 3.1 seismic_importer | 0.3 SpreadsheetLayers | 2.1.2 timemanager | 3.6 vertex_compare | 0.0.1 db_manager | 0.1.20 processing | 2.12.99