Adding new driver to pyodbc in Glue Python shell

3

How can I add an ODBC driver to my Glue Python shell job? I am trying to use the pyodbc library and can see with pyodbc.drivers() the MySQL and PostgresSQL are available however I would like to add a different driver. Note that I specifically asking for Python Shell jobs not Spark Glue jobs.

질문됨 일 년 전2113회 조회
2개 답변
0

Hello! Unfortunately I still can not see any answers to the original question. How can I add new type of ODBC driver to pyodbc in python shell (e.g. DB2)? Glue 4.0 job above python 3.9 with "library-set":"analytics" parameter provide the pyodbc library, but I have not found any example or guide to add DB2 ODBC driver.

답변함 6달 전
-2

For Python V 3.9 or upwards, please follow https://docs.aws.amazon.com/glue/latest/dg/add-job-python.html#create-python-extra-library

  • pyodbc is already supported by python shell Glue jobs - so, you should be able to import that library directly.
  • For other libraries (or other version of pyodbc), please provide a whl/egg file or use pip commands.

For older versions, download the wheel file from https://pypi.org/project/openpyxl/#files and uploaded it to Amazon S3 and get the S3 URI. if you are creating/editing the Python shell in the console: Job Details , Advanced properties, Additional Python Files. If you are using command lines use these properties:

--default-arguments '{"--extra-py-files" : ["s3URI"]}

profile pictureAWS
답변함 일 년 전
  • I understand that the pyodbc library is supported in Python shell Glue jobs. My question is about adding new ODBC drivers to my Glue job so that I can use them with pyodbc

  • The drivers for Ms SQL should be available in Python Shell job. Please try the following: Create a glue connection to your database (it's in Glue Console > Connections > Choose JDBC), test the connection make sure it can hit your database Now in your job, you must set it to reference/use this connection. (Check Settings).

    I have connected to MS SQL is my Glue Shell job using pymysql. https://pymssql.readthedocs.io/en/latest/

    Please let me know if you still face any trouble. If this helps, please upvote/accept answer.

  • To elaborate on the second option proposed there (install a different version), you can use --additional-python-modules the value is passed directly to pip so you can ask for a specific version, for instance --additional-python-module with value "pyodbc==4.0.34"

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

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

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

관련 콘텐츠