jupyterlab/jupyter-collaboration

migrate changes from .jupyter_ystore

SaahilSabu opened this issue · 2 comments

Problem

Is there a way I can extract data from .jupyter_ystore.db and reflect these changes to a new ipynb?

Additional context

I have a .jupyter_ystore.db file but I would like to be able to migrate the content in my ipynb to a new one using the ystore db, Is this possible ?

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

It is possible, using a SQLiteYStore:

from asyncio import run
from pycrdt import Doc
from pycrdt_websocket.ystore import SQLiteYStore

async def main():
    doc = Doc()
    async with SQLiteYStore(".jupyter_ystore.db") as ystore:
        await ystore.apply_updates(doc)
    # do something with doc, for instance:
    print(doc.source)

run(main())