Add new cell type for Cypher that mirrors what SQL cells can do #8589
Replies: 6 comments 10 replies
-
|
I'm not certain we want to open up multiple different cell types yet- something we'd definite need to discuss a bit more- seems like a large can of works. Would it be possible to register a Moving over to a discussion for now |
Beta Was this translation helpful? Give feedback.
-
|
first - it gets linting / syntax highlighting. Registering a driver is something that my prototype does. |
Beta Was this translation helpful? Give feedback.
-
|
@dmadisetti would one of these be a better approach:
|
Beta Was this translation helpful? Give feedback.
-
|
thanks @akshayka - I have seen the widget. We've discussed it on discord as well. I get the concerns about new cell types or plugins. For now. I'm going to fall back to what I was doing (some small helper functions), which will hide some of the boilerplate needed. |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, we're interested in a custom input cell type. We use a custom DSL to query internal systems, so having support for that on the input side would be really helpful. |
Beta Was this translation helpful? Give feedback.
-
|
What about an alternative that handles Cypher and every other niche DSL without marimo having to maintain any of them? The Cypher request makes sense, but if we add it we're also saying yes to every other graph DB query language, every internal company DSL, every domain-specific syntax someone wants first-class editing for. That's a lot of adapters to carry and most of them won't be relevant to most users. What if we made cell languages pluggable instead? A package like How it would workA package registers a language at runtime: # somewhere in marimo_our_company_dsl/__init__.py
mo.register_language(
name="our-company-dsl",
wrapper="mo.our_company_dsl", # how the cell is stored on disk
js_module="/@file/marimo_our_company_dsl/our-company-dsl-editor.js", # bundled web component
element_name="our-company-dsl-editor", # the custom element tag
)The
On disk the cell still looks like plain Python: What marimo actually needs to changeThe infrastructure is mostly already there. Anywidget does exactly this for output widgets, so we'd be reusing the same Python: a small language registry + Frontend: one new branch in const customLang = languageRegistry.get(language);
if (customLang) {
await import(/* @vite-ignore */ customLang.jsModule);
const el = document.createElement(customLang.elementName);
el.setAttribute("code", dslCode);
el.addEventListener("code-change", (e) => updateCellCode(e.detail.value));
containerRef.current.append(el);
} else {
// existing CodeMirror path, unchanged
}Plus wiring registered languages into the language toggle UI dynamically. That's genuinely most of it. I'd estimate about a week of work total, and the anywidget precedent makes the dynamic loading part pretty low risk. The upside for the Cypher caseThe original request mentioned a working prototype. With this approach that prototype could ship as Things worth discussing
Does this feel like the right direction or is there a reason to keep adapters in-tree? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
For people who work with property graph databases that support the Cypher query language, it would be nice to have a new type of cell to support working with those databases. Neo4j, for example, has a python driver as well as a python library for visualizing the graphs returned by such queries. The cell could have an option to return a dataframe or a widget for visualization.
Suggested solution
I have a working prototype of this capability devloped with the help of claude code.
Are you willing to submit a PR? (You must receive approval from the team before submitting a PR.)
Alternatives
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions