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.

gefragt vor einem Jahr2125 Aufrufe
2 Antworten
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.

beantwortet vor 6 Monaten
-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
beantwortet vor einem Jahr
  • 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"

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen