Can we create a plugin to connect tw with a database??
I need to quick create a front end for some databases.
Can you help me?
Can we create a plugin to connect tw with a database??
I need to quick create a front end for some databases.
Can you help me?
Would seem this would be simple - but it ain’t.
Accessing databases is complex at the best of times, and currently would require someone with both knowledge in TiddlyWiki data tiddlers and RESTful access to external databases which usually involves some type of Authentication token - API Key. The key sets the permissions to access the database.
Once over that hurdle, can then access data from the database. For an example of a well implemented, organized, and publicly available database, check out NASA. Some database systems, such as Mongo, have RESTful libraries which automate REST access - or at least try.
Direct connections to databases are generally not allowed from a browser, is a server-to-server kinda thing. Even personal or private databases should have some type of RESTful interface using Node.js http, express, koa, apache, nginx, etc to allow access by browser based applications.
TiddlyWiki is like any web page accessing a database. A web page would use a REST fetch implemented in a <script>
to request data from a database. TiddlyWiki also has a http request mechanism which can be used to perform the same action.
Once the data is received from the database, would want to place the data in a data tiddler dictionary or JSON for the data to be available for use by TiddlyWiki. This usually involves ‘flattening’ the data into a Name:Value pair which may require the generation and management of multiple data tiddlers to hold all the information.
Do not wish to discourage anyone from doing this - and maybe my head is stuck in-the-weeds and over complicating it.
If someone has a simpler method of implementing data from-the-cloud databases into TiddlyWiki easier, would be greatly interested.
I think it can’t, because it is front end.
TiddlyWiki is an app. So it is possible to use it as a frontend, but the questions raised by poc2go will need to be answered.
@Luis_Javier_Gonzalez
The information in your OP is not enough to help you.
Sure I am oversimplifying, but what about MWS?
Isn’t it a SQLite database that interacts with a TW frontend?
My point is that if you achieve acomodate data into that SQLite database in a format understandable by MWS you should be able to interact with it natively via TW.
Yes it is possible - at least if using Google Sheets as the db backend:
@Siniy-Kit is doing it, using google sheets as a backend for his TW-based webstore, and the TiddlyGoo project (by @Mark_S and me) took some parts of Siniy-Kit’s solution and generalized it into a plugin, that was limited to fetching from the sheet though. Unfortunately, Google changed something in their API so it no longer works but I’d guess 95%, if not 99%, of it is reusalbe if someone was to, again, extract the critical bit from Siniy-Kit’s solution or just otherwise understand the Google API. I’m guessing Siniy-Kit has also solved the writing part.
MWS demonstrates an architecture for integrating SQLite on the server side of TiddlyWiki (there is also a PR linked from MWS that demonstrates how to use SQLite in the browser).
MWS uses its own custom schema that represents tiddlers within a SQL database in a way that allows filter operations to be computed efficiently. The schema is somewhat more complicated than you might expect: rather than a table called “tiddlers” with a column for each field, MWS has a “tiddlerfields” table that uses a row for each field of each tiddler.
MWS does not support the request in the original post in this thread which is asking about connecting to an existing database with a predefined schema. I suspect that in general that is going to need custom code specific to the schema in order to be efficient.
Hi, Mat. I don’t use Google API to get data from spreadsheets. And I don’t use fetch in javascript, because it works slow. We can open spreadsheet as table, xml, JSON and JSONP
I use JSONP to get data from spreadsheet, it works faster than fetch.
To put data from TW to spreadsheet I use doPOST() function in google Apps Script ( if I need to put data with password) or I send POST by google form (order from the store).
for example here is spreadsheet (not my) Товары для страйкбола Политех - Google Spreadsheets
and here is TW html, that imports data from this spreadsheet on open Бесплатный интернет магазин на Гугл таблицах с сайта heeg.ru — Heeg.html