Skip to content

Layered checkout write support #662

Merged
gruuya merged 39 commits intomasterfrom
layered-checkout-write-support-cu-21phdxv
Apr 5, 2022
Merged

Layered checkout write support #662
gruuya merged 39 commits intomasterfrom
layered-checkout-write-support-cu-21phdxv

Conversation

@gruuya
Copy link
Copy Markdown
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

gruuya added 23 commits March 14, 2022 15:58
…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
gruuya added 6 commits March 29, 2022 14:55
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
Comment thread splitgraph/core/fragment_manager.py Outdated
Comment thread splitgraph/core/fragment_manager.py
Comment thread splitgraph/resources/static/audit_trigger.sql
Comment thread splitgraph/hooks/data_source/base.py Outdated
Comment thread splitgraph/core/table.py
Comment thread splitgraph/core/repository.py Outdated
Comment thread splitgraph/core/image.py Outdated
gruuya added 2 commits April 4, 2022 11:51
- 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.
Comment thread splitgraph/core/fragment_manager.py Outdated
Comment thread splitgraph/core/overlay.py
Comment thread splitgraph/core/fragment_manager.py Outdated
Comment thread splitgraph/core/fragment_manager.py Outdated
Comment thread splitgraph/engine/base.py Outdated
Comment thread test/splitgraph/commands/test_writable_lq.py
gruuya added 3 commits April 5, 2022 10:06
- 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
Copy Markdown
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.

2 participants