Skip to content

feat: time::now() and SurrealDB function support in field values #3

@albedosehen

Description

@albedosehen

Context

SurrealDB v3 DATETIME fields reject Python ISO strings. The correct approach is using time::now() in SurrealQL. Kushtaka needs to set timestamps via time::now() but surql-py's create_record/merge_record pass Python values that get serialized as strings.

Examples

# Current (raw):
await query("CREATE table SET created_at = time::now(), updated_at = time::now()")

# Desired:
from surql import create_record, SurrealFn
await create_record('table', created_at=SurrealFn('time::now()'), updated_at=SurrealFn('time::now()'))

Needed

  • A way to pass SurrealDB functions (time::now, time::format, math::*) as field values in CRUD operations
  • These should be rendered as-is in the SurrealQL, not as parameterized string values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions