LabVIEW Cloud Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

Aws dynamoDB access

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 .

Abdelhak_Khammeri_0-1583764507078.png


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

  

0 Kudos
Message 1 of 4
(1,178 Views)

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

 
 

 

0 Kudos
Message 2 of 4
(1,167 Views)

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')
0 Kudos
Message 3 of 4
(1,148 Views)

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

 

 

DNatt, NI
0 Kudos
Message 4 of 4
(1,143 Views)