oracle/dbt-oracle

[Bug] Null values in column_id causes error in documentation generation

acrede opened this issue · 5 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When running dbt docs generate an error is caused when there are Null values in sys.all_tab_columns.column_id.

Error:

[...]
  File "...\lib\site-packages\dbt\task\generate.py", line 100, in add_column
    column_data["index"] = int(column_data["index"])
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

The column has no not null constraint and can be null sometimes.

Expected Behavior

The documentation should be created even if null values are present.

Steps To Reproduce

No response

Relevant log output using --debug flag enabled

No response

Environment

- OS: Ubuntu 22.04
- Python: 3.10
- dbt: 1.5

What Oracle database version are you using dbt with?

19c

Additional Context

This issue could be solved easily by changing the sql in /include/oracle/macros/catalog.sql:

with columns as (
    [...]
	// column_id ordinal_position,				# old
        coalesce(column_id, 0) ordinal_position,		# new
[...]

Thanks @acrede for reporting this issue. I am checking this.

Is this fixed?

@Gabriel-L-Silva Sorry for the delay here. We somehow could not reproduce this problem. Are you testing against on-prem Database or Autonomous Database?

There are a couple of cases which I want to clarify:

  • what if column_id is null for multiple relations or
  • what if multiple column_ids are null in the same relation
    In both the cases, column_id will be 0. I just want to make sure the documentation doesn't break in such cases

@Gabriel-L-Silva @acrede
This is fixed in dbt-oracle==1.6.0

thank you!!