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

AttributeError: module 'target_snowflake.sql' has no attribute 'Identifier' #32

Open
franloza opened this issue Sep 24, 2021 · 0 comments · May be fixed by #33
Open

AttributeError: module 'target_snowflake.sql' has no attribute 'Identifier' #32

franloza opened this issue Sep 24, 2021 · 0 comments · May be fixed by #33

Comments

@franloza
Copy link

Hello!

I think I've found a bug when trying to set a column as nullable. I changed the tap schema to accept NULL and now the target is raising an AttributeError. The problem may be in this function:

https://github.com/datamill-co/target-snowflake/blob/master/target_snowflake/snowflake.py#L579-L587

Traceback

target-snowflake | ERROR Exception writing records
target-snowflake | Traceback (most recent call last):
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/snowflake.py", line 150, in write_batch
target-snowflake |     written_batches_details = self.write_batch_helper(cur,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/sql_base.py", line 822, in write_batch_helper
target-snowflake |     remote_schema = self.upsert_table_helper(connection,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/sql_base.py", line 499, in upsert_table_helper
target-snowflake |     self.make_column_nullable(connection,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/snowflake.py", line 586, in make_column_nullable
target-snowflake |     table_name=sql.Identifier(table_name),
target-snowflake | AttributeError: module 'target_snowflake.sql' has no attribute 'Identifier'
target-snowflake | CRITICAL ('Exception writing records', AttributeError("module 'target_snowflake.sql' has no attribute 'Identifier'"))
target-snowflake | INFO MillisLoggingCursor: 98 millis spent executing: ROLLBACK
target-snowflake | Traceback (most recent call last):
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/snowflake.py", line 150, in write_batch
target-snowflake |     written_batches_details = self.write_batch_helper(cur,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/sql_base.py", line 822, in write_batch_helper
target-snowflake |     remote_schema = self.upsert_table_helper(connection,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/sql_base.py", line 499, in upsert_table_helper
target-snowflake |     self.make_column_nullable(connection,
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/snowflake.py", line 586, in make_column_nullable
target-snowflake |     table_name=sql.Identifier(table_name),
target-snowflake | AttributeError: module 'target_snowflake.sql' has no attribute 'Identifier'
target-snowflake | 
target-snowflake | During handling of the above exception, another exception occurred:
target-snowflake | 
target-snowflake | Traceback (most recent call last):
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/bin/target-snowflake", line 8, in <module>
target-snowflake |     sys.exit(cli())
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py", line 57, in cli
target-snowflake |     main(args.config)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py", line 51, in main
target-snowflake |     target_tools.main(target)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/target_tools.py", line 28, in main
target-snowflake |     stream_to_target(input_stream, target, config=config)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/target_tools.py", line 77, in stream_to_target
target-snowflake |     raise e
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/target_tools.py", line 70, in stream_to_target
target-snowflake |     state_tracker.flush_streams(force=True)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/stream_tracker.py", line 47, in flush_streams
target-snowflake |     self._write_batch_and_update_watermarks(stream)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_postgres/stream_tracker.py", line 67, in _write_batch_and_update_watermarks
target-snowflake |     self.target.write_batch(stream_buffer)
target-snowflake |   File "/project/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/snowflake.py", line 164, in write_batch
target-snowflake |     raise SnowflakeError(message, ex)
target-snowflake | target_snowflake.exceptions.SnowflakeError: ('Exception writing records', AttributeError("module 'target_snowflake.sql' has no attribute 'Identifier'"))
@franloza franloza linked a pull request Sep 24, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant