Is there a way for me to run a SQL query on my local database?
I've had some issues with my local db due to a manual error, so I can't complete a migration. I know what the issue is (I need to delete some duplicate rows), but is it possible for me to run SQL on my local db?
5 Replies
Hi @CamBlackwood. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can run SQL queries on your local database. However, the specific steps to do this can vary depending on the database system you are using.
If you are using Postgres, you can use the
psql
tool to connect to your database and run SQL commands. Here's a general idea of how you can do it:
1. Open your terminal.
2. Connect to your database with the psql
command. You'll need to know your database name, username, and password.
3. Once you're connected, you can run SQL commands directly.
Please note that this is a general guide and the exact commands might differ based on your setup. Always ensure to backup your data before running any commands that modify your database.
Unfortunately, the provided knowledge sources do not contain specific instructions on how to connect to a local database using Wasp or how to run SQL commands using Wasp. For more detailed instructions, you might want to refer to the official documentation of the database system you are using.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @CamBlackwood, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Hi @CamBlackwood . If you're using the SQLite (actually this works with Postgresql as well), I'd recommend the DBeaver client. https://dbeaver.com/docs/dbeaver/Database-driver-SQLite/.
Thanks 🙂 I actually ended up doing that in the end
👍
Thanks for helping out @cmilazzo, appreciate it!
@CamBlackwood yeah, beaver is a pretty nice, that's a good way to go.
Another way to go would be using the official
sqlite3
command: https://www.sqlite.org/cli.html
It does exactly what you think: you give it a file, and it gives you a DB shell