Skip to content

Retrive data from amazon dynamo db using c #7

Description

@amanaf-korewireless

iam new in C language. i used aws_dynamo library for amazon dynamo db communication. i successfully created a table using using aws_dynamo library.

Resultent table like this

timestamp | name

101 | manaf

102 | manaf2

But i can't fetch data from db using aws_dynamo library.

This is my code

static int example_get_item(struct aws_handle *aws)
{
    struct aws_dynamo_attribute attributes[] = {
        {
         .name = "name",
         .name_len = strlen("name"),
         .type = AWS_DYNAMO_STRING,
         }
    };
    struct aws_dynamo_get_item_response *r = NULL;
    struct aws_dynamo_attribute *real_name;

    const char *request = "{\
    \"TableName\":\"testTable\",\
    \"Key\":{\
        \"HashKeyElement\":{\"N\":\"101\"}\
    },\
    \"AttributesToGet\":[\
        \"name\"]\
    }";

    r = aws_dynamo_get_item(aws, request, attributes,
                sizeof(attributes) / sizeof(attributes[0]));
    if (r == NULL) {
        return -1;
    }
    if (r->item.attributes == NULL) {
        aws_dynamo_free_get_item_response(r);
        return -1;
    }
    real_name = &(r->item.attributes[0]);
    printf("name = %s \n", real_name->value.string);
    aws_dynamo_free_get_item_response(r);
    return 0;
}

I need to get more than 1000 values from amazon dynamoDb using C code. What is the actual issue?. is this aproach is best for me?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions