Comments (5)
from dynamoquery.
Hello!
THank you for the report, looks like this part of the documentation is outdated.
You can use ProjectionExpression
directly.
https://altitudenetworks.github.io/dynamoquery/dynamo_query/expressions.html#projectionexpression
from dynamo_query.expressions import ProjectionExpression
keys = ['first_name', 'last_name']
projection_expression = ProjectionExpression(*keys)
Please let me know if this helps or if you have any further questions.
from dynamoquery.
the solution above did not work as expected. I am using dynamoQuery version 1.0.1 . this is what I have tried thus far.
from dynamo_query import DynamoQuery
from dynamo_query.expressions import ConditionExpression, ProjectionExpression
import boto3
table = boto3.resource('dynamodb').Table('mytable')
projection_attributes =["name", "address"]
data={"foo" :"student"}
query = DynamoQuery.build_query(key_condition_expression=(ConditionExpression=("foo")
), projection_expression = (ProjectionExpression(projection_attributes ))
. table(table - table , table_keys=('foo','bar'))
#when i look at the query.__dict__ object the projection expressions look like below
'ProjectionExpression':<ProjectionExpression "{['name','address']}">},
#when I pass the hardcoded string to the query
query = DynamoQuery.build_query(key_condition_expression=(ConditionExpression=("foo")), projection_expression = (ProjectionExpression("name","address")). table(table = table , table_keys=('foo','bar'))
'ProjectionExpression':<ProjectionExpression "{name},{address}">},
the latter works.. the former does not. let me know how can I write the projection expression correctly using version 1.0.1. if you can show me an example using the code above that would be great
Thanks,
from dynamoquery.
Sorry, it actually accepts *keys
, so it should be ProjectionExpression(*projection_attributes)
from dynamoquery.
yup that worked as expected.
from dynamoquery.
Related Issues (7)
- How could I control the serialization of an enum in a DynamoRecord? HOT 2
- Example for conditional upsert HOT 1
- added extra fields in upsert_record breaks _convert_record HOT 2
- Is it possible to create a batch_get_records type query that uses an alternate index? HOT 2
- Provide consistent_read flags for query and scan on DynamoTable
- cut a release - last release 9/2020 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamoquery.