This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def query_data_with_lsi(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Posts') | |
response = table.query( | |
IndexName='user_name_subject', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def create_table_with_lsi(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.create_table( | |
TableName='Posts', | |
KeySchema=[ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def query_data_with_gsi(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Employees') | |
response = table.query( | |
IndexName='email', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def create_table_with_gsi(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.create_table( | |
TableName='Employees', | |
KeySchema=[ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def fetch_data_with_range(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Books') | |
resp = table.get_item( | |
Key={ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def create_table_with_range(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.create_table( | |
TableName='Books', | |
KeySchema=[ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def multi_part_scan(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
response = table.scan() | |
result = response['Items'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def scan_first_and_last_names(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
resp = table.scan(ProjectionExpression="first_name, last_name") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def scan(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
resp = table.scan() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def create_bunch_of_users(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
for n in range(3): | |
table.put_item(Item={ |
NewerOlder