Ask coding questions
How would I host a SQL database on a SQLite repl, and access it from JS on another repl?
Hello, to do that, use the sqlite3 package.Click meThey have some nice docs and it's actively maintained :)
There are way too many callbacks for each function kind of annoying, but you can use promises to make a workaround using await
@Coder100 Sorry, if I was not clear, but I was wondering how I can connect to the database from a different repl. Also, I'm using vanilla JS. I'm making a website and need SQL.
you would have to use sqlite3 to use write and parse binary data, and a sqlite3 repl is basically a database sandbox, so they aren't really useful for a full-blown database. @CodeLongAndPros
@Coder100Necroposting but what you could do, if it's entirely internal, is make a flask that accepts requests and runs those sql commands.
but remember this is not python, it's a sqlite database playground, all the adat is stored in memory, it gets cleared each time you run! @johnnghabs
also maybe try using that sqlite3 lib everyone was talking about @CodeLongAndPros
@Coder100If the data is cleared every run, you forgot to commit them. On this note, you're not limited to a sqlite3, you can use python and just import sqlite3 lib there
@johnnghabs No, replit has problems storing progomatically-written files. Why else did they create replitdb?
@CodeLongAndPros I'm quite fascinated; what happens with replit if one tries to use a SQL db? AFAIK replitdb was designed for easier usage as it doesn't have the SQL learning curve.
@johnnghabs It'll work, but it's not deterministic— a change committed may or may not show up in the database (or stay there)