Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Fix MutableMapping for python 3.10 #160

Closed
wants to merge 6 commits into from

Conversation

Limess
Copy link
Contributor

@Limess Limess commented May 25, 2022

Context

Support Python >= 3.10

This fails on Python 3.10:

[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -   File "/virtualenvs/pipelinewise-target-redshift/bin/target-redshift", line 8, in <module>
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -     sys.exit(main())
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -   File "/virtualenvs/pipelinewise-target-redshift/lib/python3.10/site-packages/target_redshift/__init__.py", line 447, in main
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -     persist_lines(config, singer_messages, table_cache)
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -   File "/virtualenvs/pipelinewise-target-redshift/lib/python3.10/site-packages/target_redshift/__init__.py", line 162, in persist_lines
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -     primary_key_string = stream_to_sync[stream].record_primary_key_string(o['record'])
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -   File "/virtualenvs/pipelinewise-target-redshift/lib/python3.10/site-packages/target_redshift/db_sync.py", line 360, in record_primary_key_string
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -     flatten = flatten_record(record, self.flatten_schema, max_level=self.data_flattening_max_level)
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -   File "/virtualenvs/pipelinewise-target-redshift/lib/python3.10/site-packages/target_redshift/db_sync.py", line 164, in flatten_record
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO -     if isinstance(v, collections.MutableMapping) and level < max_level:
[2022-05-25, 16:19:55 BST] {{subprocess.py:92}} INFO - AttributeError: module 'collections' has no attribute 'MutableMapping'

See https://stackoverflow.com/a/71902541/2738092 for context.

Checklist

@craigastill
Copy link

In absence of a Maintainer review (12 months at time of writing this), this PR is a cleaner fix for the imports vs #228 .

There's currently no automated validation for the fix. My suggestion would be to add a python 3.10 CI job.

@Limess Limess marked this pull request as draft January 12, 2024 17:22
@Limess Limess marked this pull request as ready for review January 12, 2024 17:22
@Limess Limess closed this Jan 12, 2024
@Limess
Copy link
Contributor Author

Limess commented Jan 12, 2024

Re-raised as #298 as I had raised from our forks master branch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants