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

Simplify table client APIs #4

Open
begelundmuller opened this issue Jun 17, 2021 · 0 comments
Open

Simplify table client APIs #4

begelundmuller opened this issue Jun 17, 2021 · 0 comments
Labels

Comments

@begelundmuller
Copy link
Member

begelundmuller commented Jun 17, 2021

Summary

The client APIs for dealing with tables has gotten a little too nested and intricate. This issue investigates if we can settle on a flatter and more straightforward interface. Ideally, we can unify the lower-level and "easy" functions in one interface. It seems it's okay to be slightly less verbose than we are today (the verbosity might actually be adding complexity).

Risks and challenges

  • Balance between verbosity and simplicity
  • Is it a sufficient leap in simplicity?
  • Make sure it's portable to JS and the upcoming Go client

Involved components

  • Python client
  • Data server

Proposed changes

WIP alert! Starting with the UX, I imagine a refactored Python client interface like this:

table = await client.table("user/project/table", schema=...)
table = await table.version(...) # optional

# writing
await table.write(records, deletes=...)

# querying
cursor = await table.log(replay=True, changes=True, subscription=...) # consumers embedded
cursor = await table.index("time >= '2021-02-01'")
cursor = await client.olap(f"SELECT count(*) FROM {table}")

# reading
df = await cursor.df()
records = await cursor.all()
async for record in cursor:
    print(record)
async for batch in cursor.batches(size=...):
    print(record)
await cursor.consume(callback)
# + consumer APIs, including batching and time delay

# get/set features
await table.get({ ... }) # maps to table.index
await table.set({ ... }, { ... }) # oltp writes (+ ability to pass timestamp to fence writes)
await table.delete({ ... }) # oltp delete

# checkpointers?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant