register data source / dataframe?
Say I have a python call that returns a dataframe. without assigning it to a variable within the notebook itself, is there a way I can register it as a data source? like from a module i'm importing?
Example:
7 Replies
not currently.
As a workaround: you may be able to put this in a dict in
mo.state({})
and then have a dropdown selected_df = mo.ui.dropdown(get_state())
and build your own "data source explorer"ok! is this something you would be interested in supporting in the longer term?
yea, i think we could add support for this, esepcially if you are open to contributing it. we would likely need a way to handle cleanup too (maybe just weakrefs)
i can see a few advanced tooling like
mo.editor.register_dasource
yes, i can def help implement it!!
is a github issue the preferred place to work out the spec?
Yea GitHub issue is fine. Just to clarify, what's the main reason you'd like to register as a data source? Is it to see the schema in the data sources panel?
the data sources panel is def one big one, helps summarize to a user what data an agent has fetched already in my use case; the other reason is to then be able to reference them using the @ syntax in the ai generated cells
GitHub
Register Data Sources · Issue #2766 · marimo-team/marimo
Description Right now, only global scope dataframes are saved by marimo for reference. However, I'd love to be able to have them saved to marimo without explicitly defining it as a variable For...