In this tutorial I’m gonna show you how to get MULTIPLE ReplitDBs in Python.
- Make a
Database
class
from replit import db
Database = type(db)
- make instances of it
from replit import db
Database = type(db)
new_db = Database('https://' + 'DB URL here')
Template here: https://replit.com/@SnakeyKing/Multiple-ReplitDBs-Template
Could you show an example of this in action?
Well, I dunno wether this works or not.
Then shouldn’t you be sure before posting this?
It’s like writing a book on history then saying ‘I don’t know if this is true’.
Please confirm that the code is correct before posting it.
P.S. DB urls are very unsafe.
Well I looked in the replit library and apperantly there is a Database
class
well, each repl only gets one db url. Don’t use database proxies because I already hacked into both of idkwhttph’s and added a rick roll.
yes, in fact, it’s located at replit.database.Database
, along with other datatypes.
1 Like
Or…
from replit import db
db.db_url = os.environ['DB_URL']
AND PLEASE DO NOT USE THIS IF YOU DON’T HAVE A WEBSITE ON YOUR REPL
Well then that means the only situation using ReplitDB proxies are safe are is when you want to share the DB accross multiple Webview-repls.
2 Likes
Yeah. Until Replit fixes Repl identity.
1 Like