#Changing a Json code to MySQL

1 messages · Page 1 of 1 (latest)

jovial badge
#

probably might wanna learn SQL first

spark vale
#

If you know SQL, then you should know how prepared statements work. If you know how prepared statements work, you should be able to easily convert your JSON data into a columnar schema.

Only you can determine which columns you need. Although if you don't have or need a defined, indexed schema, or otherwise need flexibility, a docstore like MongoDB (Or pgsql with its JSON column type) might serve you better than an RDBMS like MySQL

jovial badge
#

good point. MongoDB may be easier to transition to, since MongoDB works kinda massive JSON collections and documents. There are two options you can do: Migrate your data to use MongoDB, or use an RDBMS, like MySQL / MariaDB or PostgreSQL

#

It's really up to you as the developer to determine what data needs to be saved. And what columns you need. Internally a lot of my bots used PostgreSQL, but that choice may be different depending on what you really want

#

For going the MongoDB route, I highly suggest using an async ODM like Beanie to save and manage the data w/ your bot. For the RDBMS route, you probably would want to use an ORM (SQLAlchemy, Tortious, etc) to deal w/ selecting data, etc

#

For PostgreSQL, use asyncpg as your driver. For MySQL/MariaDB, asyncmy is a good choice

jovial badge
#

np