1

I made a database on Replit. I'm using Flask and SQLAlchemy. I was wondering whether anyone knows how I can see my database (e.g. on the Console log) because I think I've added the same new user 2 times.

Ouroborus
  • 16,237
  • 4
  • 39
  • 62
FraneCal
  • 69
  • 8
  • There's no GUI interface. You'd access it programmatically or by `curl` as described in [the docs](https://docs.replit.com/hosting/databases/replit-database#where-can-i-find-my-database). – Ouroborus Apr 25 '23 at 13:09

1 Answers1

0

There is no GUI interface for Replit DB

Since Replit DB is treated similarly to a Python dictionary, you should be able to just print the database like so:

# importing database
from replit import db

# assigning some data so that it actually prints something out
db["hello"] = "hello, world!"

# printing the db
print(db)

The result should be the following:

>>> {"hello":"hello, world!"}

Therefore, you can directly use db when displaying database data.

Like so:

from flask import Flask
from replit import db

app = Flask(__name__)
db["my_num"] = 3

@app.route("/")
def index():
    return db

References

Replit DB docs

Flask docs

If my answer is unclear, please let me know by commenting.

Beedful
  • 115
  • 2
  • 11