Coding-with-Adam / Dash-by-Plotly

Interactive data analytics
dash-by-plotly.coding-with-adam.vercel.app
1.47k stars 1.69k forks source link

extending example for browsing tables of available Mongo databases #31

Closed schwabts closed 1 year ago

schwabts commented 1 year ago

Too bad, I cannot finish working this out anyway soon but there's not too much left although I'm having a hard time with line 105. Also I missed line 74 but I think this is the way to go for exploring Mongo databases. The tiny helper function on line 79 should be noteworthy, too.

Coding-with-Adam commented 1 year ago

Why is line 105 error saying "Expected one of []"? It's weird to me that it is expecting a value from an empty list. Line 79 is helpful. Thank you, I might use that :)

I've never written an Input like you did: Input(id(__name__,"interval_db"), 'n_intervals'), What does that id__name___ do?

schwabts commented 1 year ago

Do you get the same?

For me, the error occurs when selecting the table system.version which is the only one available so far.

The callback is supposed to load its current contents into dataframe df and there must be a column mismatch, I guess just because the ValueError also says that age was received.

Well, the dynamic identifier is for my multi-page app where I copied the page from. In Avoiding duplicate ids AnnMarie quoted id(name, localid). The easiest way to transfer it you your single page examples is to

def id(name, localid):
    return localid

Sorry for having missed to adapt that before creating the PR.

Coding-with-Adam commented 1 year ago

No, for me the code actually doesn't run. I saw the error message written on line 105. If I could actually run the code and reproduce the error, that would make things a lot easier.

schwabts commented 1 year ago

Tracing revealed that the reason for the error message written on line 105 is an empty cursor.

schwabts commented 1 year ago

No, for me the code actually doesn't run. I saw the error message written on line 105. If I could actually run the code and reproduce the error, that would make things a lot easier.

It should make more sense with the separate file now.

Moreover, the same code is now easier to use in single-page as well as multi-page apps although I'm still not yet using a global flag to decide between these cases.

Coding-with-Adam commented 1 year ago

hey @schwabts remind me what's the goal with this PR please. Is this for updating the current docs on coding-with-adam or you're just sharing an example of how you made the connection to MongoDB?

schwabts commented 1 year ago

hey @schwabts remind me what's the goal with this PR please. Is this for updating the current docs on coding-with-adam or you're just sharing an example of how you made the connection to MongoDB?

I added an example letting you browse all tables of all available MongoDB databases. So showing "how to connect to MongoDB" somehow misses the point of this.

Coding-with-Adam commented 1 year ago

Wonderful. Thank you Thomas @schwabts . I appreciate you adding this very helpful example. I just merged it.

I don't recall writing anywhere "how to connect to MongoDB". Let me know where you saw that, and I will update it to "how to connect to multiple tables in MongoDB"