Skip to content
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

[Bug] Seed fails, if a column has no values #100

Closed
1 task done
jpuris opened this issue Aug 8, 2023 · 4 comments
Closed
1 task done

[Bug] Seed fails, if a column has no values #100

jpuris opened this issue Aug 8, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jpuris
Copy link

jpuris commented Aug 8, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When a seed file (csv) has a column with no values, the dbt seed will fail with

max() arg is an empty sequence

Expected Behavior

The seeding is successful

  • the table is created with value-less column
  • data is inserted correctly with value-less column having NULL values

Steps To Reproduce

  1. Add a CSV file in seeds/some_data.csv
    field_1,field_2,field_3
    1,2,
    4,5,
    
  2. Add following to dbt_project.yml
    seeds:
      dbt_project:
        some_data:
          +column_types:
            field_1: number
            field_2: number
            field_3: number
    
  3. Run dbt seed

Relevant log output using --debug flag enabled

17:52:01  While listing relations in database=ORCL, schema=dbt, found: 
17:52:01  Timing info for seed.dbt_project.some_data (execute): 19:52:00.747684 => 19:52:01.390782
17:52:01  On seed.dbt_project.some_data: ROLLBACK
17:52:01  On seed.dbt_project.some_data: Close
17:52:01  Unhandled error while executing 
max() arg is an empty sequence
17:52:01  Traceback (most recent call last):
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/task/base.py", line 388, in safe_run
    result = self.compile_and_execute(manifest, ctx)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/task/base.py", line 337, in compile_and_execute
    result = self.run(ctx.node, manifest)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/task/base.py", line 436, in run
    return self.execute(compiled_node, manifest)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/task/run.py", line 291, in execute
    result = MacroGenerator(
             ^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 330, in __call__
    return self.call_macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 257, in call_macro
    return macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 763, in __call__
    return self._invoke(arguments, autoescape)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "<template>", line 94, in macro
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 298, in call
    return __obj(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 330, in __call__
    return self.call_macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 257, in call_macro
    return macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 763, in __call__
    return self._invoke(arguments, autoescape)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "<template>", line 21, in macro
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 298, in call
    return __obj(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 330, in __call__
    return self.call_macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/clients/jinja.py", line 257, in call_macro
    return macro(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 763, in __call__
    return self._invoke(arguments, autoescape)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
         ^^^^^^^^^^^^^^^^^^^^^^
  File "<template>", line 44, in macro
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/jinja2/runtime.py", line 298, in call
    return __obj(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/adapters/base/impl.py", line 960, in convert_type
    return cls.convert_agate_type(agate_table, col_idx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/adapters/base/impl.py", line 975, in convert_agate_type
    return func(agate_table, col_idx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/my/dbt/project/.venv/lib/python3.11/site-packages/dbt/adapters/oracle/impl.py", line 109, in convert_text_type
    max_len = max(lens) if lens else 64
              ^^^^^^^^^
ValueError: max() arg is an empty sequence

Environment

- OS: macOS 13.5
- Python: Python 3.11.1
- dbt: 1.5.3
- dbt-oracle: 1.5.2

What Oracle database version are you using dbt with?

19c

Additional Context

No response

@jpuris jpuris added the bug Something isn't working label Aug 8, 2023
@aosingh aosingh self-assigned this Aug 8, 2023
@aosingh
Copy link
Member

aosingh commented Aug 9, 2023

@jpuris

Thank you for the detailed report

I was able to reproduce this issue and will include the fix for this in the next update which is dbt-oracle==1.6.0 We are working on it and v1.6.0 and should be released in ~2 week's time. Will that work for you ?

@jpuris
Copy link
Author

jpuris commented Aug 9, 2023

Hi @aosingh.

Much appreciated! 2 Weeks will have to do :)

aosingh added a commit that referenced this issue Aug 9, 2023
@aosingh aosingh mentioned this issue Sep 14, 2023
@aosingh
Copy link
Member

aosingh commented Sep 15, 2023

@jpuris
This is fixed and released in dbt-oracle==1.6.0

aosingh added a commit that referenced this issue Sep 26, 2023
- #100
- #86
- #99
- Set connection id prefix to track dbt connections in cman logs
@aosingh
Copy link
Member

aosingh commented Oct 13, 2023

fix is back ported to dbt-oracle 1.5 and 1.4 as well

@aosingh aosingh closed this as completed Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants