Skip to content

Conversation

@osipovartem
Copy link
Contributor

Added basic example how to create inital record
Changed types of timestamps

Current problem
GSI cannot work with nested json field for indexing, that's why we insert additional columns for Query
the record looks like

{
  "Entity": "query",
  "query_id": "00000000-0000-0000-0000-000000000000",
  "SK": "1766496646387",
  "session_id": "7b171ae9-05f2-4b1d-82b8-00f6b213a90a",
  "Data": "{\"query_id\":\"00000000-0000-0000-0000-000000000000\",\"request_id\":\"0d2f6302-aefc-467d-a751-c457d970e658\",\"query_status\":\"Created\",\"query_text\":\"select current_version();\",\"session_id\":\"7b171ae9-05f2-4b1d-82b8-00f6b213a90a\",\"start_time\":\"2025-12-23T13:30:46.387570355Z\"}",
  "PK": "QUERY#2025-12-23",
  "request_id": "0d2f6302-aefc-467d-a751-c457d970e658"
}

let parsed_start_time = Self::parse_start_time(&query.start_time)?;
let pk = Self::query_pk(&parsed_start_time);
let sk = Self::query_sk(&parsed_start_time);
let pk = Self::query_pk(&query.start_time);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we have pk as start_time here? I assumed pk should be shorten to date for pk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the function query_pk

#[derive(Clone, Debug, Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct Query {
pub query_id: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use strict data types?
pub query_id: Uuid,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about session_id, it's &str everywhere (but the value itself in uuid format)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean all fields datatypes, which we want to see a part of inerface.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uuid is already there for query_id and request_id, the question about session_id.
in service we have &str as session_id, should we parse it to uuid for state store?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shortly I think it's worth to use strict type for persisted session_id as well. But it's up to you, I do not insist, especially if such datatype leads to significant efforts as of legacy code.

Copy link
Contributor

@DanCodedThis DanCodedThis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osipovartem osipovartem merged commit 27761f6 into main Dec 23, 2025
3 checks passed
@osipovartem osipovartem deleted the aosipov/basic_put_query branch December 23, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants