Circular import error while importing oracledb in AWS Glue

0

I'm trying to achieve data change capture using AWS Glue and don't want to use DMS. I'm trying to transfer data between two Oracle RDS instances which are in different AWS Account. Here I am trying to follow Delta approach (i.e., I am to transfer only updated data...) From source, we are going to fetch records for which updated data of record is greater than last job run date and place all those records in Delta table and from Delta table, we wanted to manually upsert the records to target table based on primary key.

We are using cursors to do upsert operation and trying to import oracledb for Connection. I have added below dependencies in Python Library section in AWS Glue Job details:

<s3 location>/oracledb.zip,<s3 location>/ oracledb-2.0.1.dist-info.zip,s<s3 location>/ pycparser-2.21.dist-info.zip,s<s3 location>/ pycparser.zip,<s3 location>/cryptography.zip,<s3 location>/cryptography-41.0.7.dist-info.zip,s<s3 location>/cffi.zip,<s3 location>/ cffi-1.16.0.dist-info.zip

When I am trying to run the Glue job facing error like below: Error: ImportError: cannot import name 'base_impl' from partially initialized module 'oracledb' (most likely due to a circular Import)(/tmp/oracledb.zip/oracledb/init. py)

1개 답변
1

I don't think it's a circular dependency, I believe that module needs native binding which the zip probably doesn't include (or includes for a different architecture).
Instead this works for me, add a job parameter "--additional-python-modules" with the value "oracledb", so it installs it using Pip and compiles as needed.

profile pictureAWS
전문가
답변함 4달 전
  • Thanks for solution, Do we have any option in glue where we can replicate deleted records as well. (ie, We have two AWS RDS Instances A and B. if Record is deleted in RDS A, I wanted it to be removed from RDS B as well. Does AWS Glue support this functionality.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠