Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL.DB interface and Select() implementation #9

Merged
merged 6 commits into from
Jan 27, 2022
Merged

SQL.DB interface and Select() implementation #9

merged 6 commits into from
Jan 27, 2022

Conversation

elh
Copy link
Owner

@elh elh commented Jan 27, 2022

sql implements a SQL-backed, SQL-queryable, bitemporal database. This implements the key-value oriented interface of bitempura.DB and provides SQL querying.

There is a new interface in sql with 1 major addition

// Select executes a SQL query (as of optional valid and transaction times).
Select(query squirrel.SelectBuilder, opts ...bt.ReadOpt) (*sql.Rows, error)

Example time traveling SQL query

s := squirrel.Select("type", "SUM(balance)").
    From("balances").
    GroupBy("type").
    OrderBy("SUM(balance) DESC")
rows, err := db.Select(s, bt.AsOfValidTime(t3), bt.AsOfTransactionTime(t2))

Current explorations optimizing for easiness and speed. squirrel for query building and sqlite for test db.

Status

  • No support for setting up SQL tables
  • All SQL DB functions are unimplemented
  • Decide if scoping the sql.DB around a single table makes sense
  • Interface changes?
    • Still need to decide what to do about versioning information + public interfaces
    • Consider just promoting a separate interface. KV interface and SQL interface should feel different

@elh elh merged commit 5bd2fc1 into main Jan 27, 2022
@elh elh deleted the sql-query branch January 27, 2022 19:18
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.

1 participant