I am using (Anaconda 3) Python 3.6.3 and have installed the Teradata's python module from https://pypi.python.org/pypi/teradata
I've also created a ODBC data source on my system and am able to use it to login successfully (using Teradata SQL Assistant) to a Teradata system (on a different server). Driver version is 13.00.00.09
I've written a small test code which is failing with ODBC connection issue:
import Teradata
import pandas as pd
import sys
print("attempting TD connection")
udaExec = teradata.UdaExec(appName="just_td_test", version="1.0", logConsole=False)
#
with udaExec.connect(method="odbc",system="abc", username="aaaaa",password="xxxxx", driver="Teradata") as connect:
print("connection done. querying now...")
query = "select top 10 tablename from dbc.tables;"
df = pd.read_sql(query,connect)
print(df.head())
connect.close()
Error messages:
attempting TD connection
Traceback (most recent call last):
File "td.py", line 16, in <module>
with udaExec.connect(method="odbc",system="abc", username="aaaaa",password="xxxxx", driver="Teradata") as connect:
File "C:\teradata-15.10.0.21.tar\teradata-15.10.0.21\teradata\udaexec.py", line 183, in connect
**args))
File "C:\teradata-15.10.0.21.tar\teradata-15.10.0.21\teradata\tdodbc.py", line 450, in __init__
SQL_NTS, None, 0, None, 0)
OSError: exception: access violation writing 0x0000000000000078
Exception ignored in: <bound method OdbcConnection.__del__ of OdbcConnection(sessionno=0)>
Traceback (most recent call last):
File "C:\teradata-15.10.0.21.tar\teradata-15.10.0.21\teradata\tdodbc.py", line 538, in __del__
self.close()
File "C:\teradata-15.10.0.21.tar\teradata-15.10.0.21\teradata\tdodbc.py", line 513, in close
connections.remove(self)
ValueError: list.remove(x): x not in list
Its clear that error is with ODBC connection but the error message is not clear. Teradata ODBC driver version is 13 while pypi provides the Teradata python module of version 15. Is this the reason for the error ?
I am able to solve the issue by
(1) Installing ODBC driver v16 and
(2) using DSN= instead of system= in the connection string.
So it appears the reason for my error was the version mismatch of ODBC driver I was using earlier. Hope it helps someone.
Try using another Python Teradata library like 'teradatasql' to remove dependency of Driver. This will require host, username and password parameters alone for connection.
Related
I try to connect to Azure Data Lake using Airflow. I use Airflow connection via the Web UI.
When I try to connect using the test button, I get an error Bad Request. As seen below
I use the correct UUIDs. These UUIDs have been verified in other cases. I also checked the firewall.
When I execute the DAG, I use the Azure Data Lake connection id to check if a file exists: If I apply the method as described here: What is the best way to check if a file exists on an Azure Datalake using Apache Airflow?
This is the error I get
[2022-05-06, 17:27:33 UTC] {log.py:127} ERROR - 99ec1d77-e91c-4fd3-a1c7-fa751ca1e779 - OAuth2Client:The token response from the server is unparseable as JSON: ***
Traceback (most recent call last):
File "/opt/airflow/lib/python3.8/site-packages/adal/oauth2_client.py", line 168, in _validate_token_response
wire_response = json.loads(body)
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 3 column 1 (char 4)
[2022-05-06, 17:27:33 UTC] {log.py:127} ERROR - 99ec1d77-e91c-4fd3-a1c7-fa751ca1e779 - OAuth2Client:Error validating get token response: ***
Traceback (most recent call last):
File "/opt/airflow/lib/python3.8/site-packages/adal/oauth2_client.py", line 238, in _handle_get_token_response
return self._validate_token_response(body)
File "/opt/airflow/lib/python3.8/site-packages/adal/oauth2_client.py", line 168, in _validate_token_response
Authenticating to Azure Data Lake is by token credentials i.e. add specific credentials (client_id, secret, tenant) and account name to the Airflow connection.
Information about how to set it up can be found in this doc.
You can see code example in the source code test function.
Other method of authentication are currently not supported.
I was trying to get the connection running using the Airflow implementation. My impression was that it was buggy and did not work out well. The above situation happened with Airflow 2.2.5. When I upgraded to Airflow 2.3.0, the test button was grayed out.
The final solution was to use Access Tokens instead.
Given below json:
{ "Model" : "level1" }
what is the right combination of message_filtering_match_values and message_filtering_config values? I try below but it fails:
model_operator = SQSSensor(
task_id='model_operator',
dag=dag,
sqs_queue='https://sqs.somewhere/somequeue.fifo',
aws_conn_id='aws_default',
message_filtering='jsonpath',
message_filtering_config='Model[*]',
message_filtering_match_values=['level1'],
mode='reschedule')
Error message is:
Broken DAG: [/usr/local/airflow/dags/test_dag.py] Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/airflow/utils/decorators.py", line 94, in wrapper
result = func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/airflow/models/baseoperator.py", line 414, in __init__
"arguments were:\n**kwargs: {k}".format(c=self.__class__.__name__, k=kwargs, t=task_id),
airflow.exceptions.AirflowException: Invalid arguments were passed to SQSSensor (task_id: model_operator). Invalid arguments were:
**kwargs: {'message_filtering': 'jsonpath', 'message_filtering_config': 'Model[*]', 'message_filtering_match_values': ['level1']}
The message_filtering / message_filtering_config / message_filtering_match_values were added recently in PR it was released in Amazon provider version 2.2.0
From the traceback we can see that these parameters are not recognized by the operator which means that you are running an older version of the Amazon provider.
You should upgrade the Amazon provider to the latest version.
pip install apache-airflow-providers-amazon --upgrade
It's also recommended to read the documentation about constraint files.
You didn't mention what Airflow version you are running nor what version of the Amazon provider so note to read the change logs in case you are upgrading major version.
I have been trying to find help for this problem and there hasn't been too much success. I keep getting this error. I was following this guide: https://cloud.google.com/community/tutorials/cloud-iot-gateways-rpi and I haven't been able to get past step 14.
source run-gateway
Creating JWT using RS256 from private key file rsa_private.pem
on_publish, userdata None, mid 1
Unable to find key 1
connect status False
on_connect Connection Refused: not authorised.
on_disconnect 5: The connection was refused.
connect status False
connect status False
connect status False
^CTraceback (most recent call last):
File "./cloudiot_mqtt_gateway.py", line 356, in <module>
main()
File "./cloudiot_mqtt_gateway.py", line 284, in main
time.sleep(1)
I was able to successfully get the gateway running but had to manually modify the script. Make sure that you have updated the run-gateway shell script to point to your registry ID and project ID.
If any of the parameters are incorrect (e.g. device, project, region) then your device will be disconnected from the device bridge.
I want to use the raspberry pi to send values to the Oracle11g database, but when I run import cx_Oracle syntax for that process, I get the following error:
Traceback (most recent call last):
File "/home/pi/20190222ex01.py", line 1, in <module>
import cx_Oracle
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 317, in _custom_import
module = self._original_import(*args, **kw)
ImportError: No module named 'cx_Oracle'
How can I solve this problem?
Update: Oracle has released Oracle Instant Client ARM64: https://www-sites.oracle.com/database/technologies/instant-client/linux-arm-aarch64-downloads.html
It means, that you have not installed module cx_Oracle.
First you must install Oracle driver with PIP:
python -m pip install cx_Oracle --upgrade
Hope it helped you.
Sorry im a total noob with this. So ive tried integrating Sikuli in my Working RF setup meaning, I have to move from Python to Jython for this to work. my problem now is that im always getting an error.
Error in file 'C:\robot\suites\Test\Test.robot':
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Traceback (most recent call last):
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
from keywords import *
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module>
from _logging import _LoggingKeywords
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\_logging.py", line 4, in <module>
from keywordgroup import KeywordGroup
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
PYTHONPATH:
C:\jython2.7.0\bin\jythonsikuli.bat
C:\jython2.7.0\Lib
__classpath__
__pyclasspath__/
C:\jython2.7.0\Lib\site-packages
CLASSPATH:
C:\jython2.7.0\jython.jar
C:\Sikuli\sikulix.jar
20180308 11:23:08.246 ERROR Error in file 'C:\robot\suites\Test\Test.robot':
Getting keyword names from library 'Remote' failed: Calling dynamic method
'get_keyword_names' failed: Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
In your error message there are two issues clearly defined:
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Which can be solved by installing the relevant Python Module from PIP:
pip install decorator
The second issue is towards the end:
Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
This means that Robot Framework is unable to make a connection on port 8720. This is often due to:
Firewalls preventing an opened port to be accessible. In Windows add a FireWall rule allowing for port 8270 to be accessible from the outside.
Try and connect using http://127.0.0.1:8270. Although often a synonym for localhost at a technical level it is not the same.