03-09-2020 09:48 AM
Hello All ,
I am using Labview to test some telematics product , for this purpose i need to have an access to DaynamoDB , i have downloaded the NI Cloud Toolkit AWS , unfortunately i didn't found what i am looking for on this Toolkit .
I found anther solution based on the cdata driver for daynamoDB https://www.cdata.com/drivers/dynamodb/odbc/?gclid=Cj0KCQjw0pfzBRCOARIsANi0g0tEXIK_56T23ehRvnniP7oKy... , it works fine but it is costly , i have to pay every year 400 dollar just to use this feature .
on the other hand , there is already a python script which works fine without any extra cost .
Have any experience with this before ? is it possible to use the python script into Labview ?
Thank you
Abdelhak
03-09-2020 04:35 PM
Hi Abdelhak
I am using labview to call python to get SAS.
You need to install python integration tool kit.
Please let me know if you need any help.
Good luck!
Hong
03-10-2020 07:51 AM
Thank you for your replay ,
Have you any example on how to do it ? this toolkit is for free ?
Please find the python script that i want to include in my labview program , Thanks for your help .
import boto3
from boto3.dynamodb.conditions import Key, Attr
def ExtractOdometer(pl):
odpl = pl[158 * 2:158 * 2 + 8]
aa = int('0x' + odpl, 16) * 5 / 1000
print(f'Odometerpip is {aa} km')
tcu_id = 'xxxxxx'
payload_type = '09'
odom_date = '2020-02-26'
print(f'Getting data for TCU {tcu_id} on {odom_date}')
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('dev_tcu')
condition = Attr('tcuid').eq(tcu_id)
condition = condition & Attr('type').eq(payload_type)
condition = condition & Attr('timestamp').begins_with(odom_date)
response = table.scan(FilterExpression=condition)
foundvalue = False
while (len(response['Items']) == 0):
if (('LastEvaluatedKey' in response) and (response['LastEvaluatedKey'])):
response = table.scan(FilterExpression=condition, ExclusiveStartKey=response['LastEvaluatedKey'])
for i in response['Items']:
ExtractOdometer(i['payload'])
foundvalue = True
break
else:
break
if not foundvalue:
print ('Odometer value not found')
03-10-2020 11:23 AM
If you're in LabVIEW 2018 or later, you could also try using the Python Node. It's got shipping examples installed here:
[LabVIEW 20xx]\examples\Connectivity\Python