fsprojects / fsprojects/FSharp.AWS.DynamoDB

Enhanced support for single-table design

Open
#59 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
F#
Stars
61
Forks
18
Avg merge
7h 27m
Merged PRs (30d)
1

Description

This is somewhat related to the caveat mentioned in the TransactWriteItems section regarding multi-table operations not being supported.

For a single-table design this limitations also pops if there are multiple instances of TableContext using the same table name, and a need arises to write more than one record type in the same request:

let baseContext : TableContext<BaseSchema> = ...
let contextFoo : Context<Foo> =  baseContext.WithRecordType<Foo>()
let contextBar : Context<Bar> =  baseContext.WithRecordType<Bar>()

let fooItems : Foo list = ...
let barItems : Bar list = ...

async {
  // Separate DynamoDB requests are needed here
  let! _ = contextFoo.BatchPutItemsAsync fooItems
  let! _ = contextBar.BatchPutItemsAsync barItems
}

The most straightforward way of resolving the immediate problem would be to make the AttributeValue helper methods on RecordTemplate here public, and from there just use the SDK to make the necessary request.

If there is another approach that offers a solution that doesn't require working with the SDK directly, and maybe solves the problem more generally for transactions as well I'd be happy to take a look, just let me know.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RecordTemplate.fs at lines 263-284 and the TransactWriteItems documentation section, then trace TableContext.WithRecordType and BatchPutItemsAsync. Define what API should support mixed record types in one request and whether the same approach should cover transactions; completion should address the single-table case without requiring callers to use the SDK directly.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, fsharp
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.