'facing issues in connecting to Teradata via python using teradatasql Module

Code:

import teradatasql

ExecutionContext = teradatasql.connect (host="xxxx", user="xxxx", password="xxx")

def select(exec_context: ExecutionContext):
    try:
        conn =exec_context.connection
        curs = conn.cursor()
        curs.execute(f"""
          sel top 10 * from dbc.tablesv
        """)
        curs.execute("COMMIT")
        curs.close()

    except Exception as e:
        raise Exception (str(e))

Error:

python3 box_code.py
Traceback (most recent call last):
  File "/Users/xx/Desktop/box_code.py", line 9, in <module>
    ExecutionContext = teradatasql.connect (host="xx", user="xxx", password="xxx")
  File "/Users/xx/miniforge3/lib/python3.9/site-packages/teradatasql/__init__.py", line 138, in __init__
    goside = ctypes.cdll.LoadLibrary(sLibPathName)
  File "/Users/xx/miniforge3/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/Users/xx/miniforge3/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/xx/miniforge3/lib/python3.9/site-packages/teradatasql/teradatasql.dylib, 0x0006): tried: '/Users/xx/miniforge3/lib/python3.9/site-packages/teradatasql/teradatasql.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))

machine: MacBook Pro (16-inch, 2021), Apple M1 Pro Chip



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source