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

Layered checkout write support #662

Merged
merged 39 commits into from
Apr 5, 2022

Conversation

gruuya
Copy link
Contributor

@gruuya gruuya commented Mar 29, 2022

This PR adds support for writes to the layered querying checkout mode, as a basis for providing writable DDN.

The founding idea is to construct a overlay view with two supporting tables:
slika
The users interact with the view directly through read/write statements, and then for reads the view merges existing, non-changed data (from the lower, foreign table as before), with the changes stored in the new "staging" (aka upper) table where all pending writes are written.

Upon committing, new object/image is created, the lower fdw table is bumped to the new image, while the upper table is truncated, thus effectively persisting all pending changes at that moment.

CU-21phdxv

…en the present and latest data

Still need to investigate edge cases, e.g. deletion of just inserted rows not working.
In particular ensure that deletion followed by insertion does not result in return of any previous insertions,
i.e. only update the merged view with records originating after the latest delete command (if any).
Also, remove the obsolete context manager in singer ingestion.
Also make all_tables optionally omit overlay component tables
We don't allow altering table schemas in layered querying mode.
Due to the missing column defaults info in our images we can't replicate these on the upper table,
and so must explicitly fill each column in INSERT statements, otherwise they'll be a silent no-op.
@gruuya gruuya self-assigned this Mar 29, 2022
Since the offending section was obsolete and removed in the latest version of black,
for more details see: psf/black#2964.
In addition, do not owerwrite FDW server when instantiating LQ checkout
In this way we can decouple LQ servers for checkout of different images in the same repo.
@gruuya gruuya requested a review from mildbyte April 1, 2022 13:30
@gruuya gruuya marked this pull request as ready for review April 1, 2022 13:30
splitgraph/core/fragment_manager.py Outdated Show resolved Hide resolved
splitgraph/core/fragment_manager.py Show resolved Hide resolved
splitgraph/resources/static/audit_trigger.sql Show resolved Hide resolved
splitgraph/hooks/data_source/base.py Outdated Show resolved Hide resolved
splitgraph/core/table.py Show resolved Hide resolved
splitgraph/core/repository.py Outdated Show resolved Hide resolved
splitgraph/core/image.py Outdated Show resolved Hide resolved
- move the central init method to a separate file in core
- add None return type to a helper protected method
- fix imports
Make sure to analyse the latest object in the asserts.
splitgraph/core/fragment_manager.py Outdated Show resolved Hide resolved
splitgraph/core/overlay.py Show resolved Hide resolved
splitgraph/core/fragment_manager.py Outdated Show resolved Hide resolved
splitgraph/core/fragment_manager.py Outdated Show resolved Hide resolved
splitgraph/engine/base.py Outdated Show resolved Hide resolved
test/splitgraph/commands/test_writable_lq.py Show resolved Hide resolved
- Skip temo table in favor of object + rename
- Remove CASCADE from deletion of foreign tables in engine
By making sure that for deleted rows the non-PK fields are NULL-ified.
Ensure table records/objects remain intact after commit if they were not written to.
@mildbyte
Copy link
Contributor

mildbyte commented Apr 5, 2022

LGTM! great work :)

@gruuya gruuya merged commit 4a431e4 into master Apr 5, 2022
@gruuya gruuya deleted the layered-checkout-write-support-cu-21phdxv branch April 5, 2022 19:56
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.

None yet

2 participants