I am working as freelancer and right now working on one of my game and trying to use Azure table service to log my user moves in Azure tables. The game is based on Cards.
The flow is like this:
Many users(UserId) will be playing on a table(TableId). Each game on the table will have a unique GameId. In each game there could be multiple deals with Unique DealId. There can be multiple deals on the same table with same gameId. Also each user will have same DealId in a single game.
Winner is decided after multiple chances of a player.
Problem:
I can make TableId as PartitionKey and but I am not sure what to chose for RowKey because combination of TableId and RowKey (GameId/UserId/DealId) should be unique in the table. I can have entries like:
TableId GameId DealId UserId timestamp 1 201 300 12345 1 201 300 12567
May be what I can do is to create 4 Azure tables like below but I am doing a lot of duplication; also I would not be able to fire a a point query as mentioned here at https://azure.microsoft.com/en-us/documentation/articles/storage-table-design-guide/#guidelines-for-table-design
GameLogsByTableId -- this will have TableId as PartitionKey and GUID as RowKey GameLogsByGameId -- this will have GameId as PartitionKey and GUID as RowKey GameLogsByUserId -- this will have UserId as PartitionKey and GUID as RowKey GameLogsByDealId -- this will have DealId as PartitionKey and GUID as RowKey
Thoughts please?
Format of TableId,GameId,DealId and UserId is long.
I would like to query data such that
- Get me all the logs from a TableId.
- Get me all the logs from a TableId and in a particular game(GameId)
- Get me all the logs of a user(userid) in this game(GameId)
- Get me all the logs of a user in a deal(dealId)
- Get me all the logs from a table on a date; similarly for a user,game and deal