I am learning Python / Flask. Now I am at the point where I am learning Flask with MySQL Database. I read lots of posts about using Flask with databases and most of them suggest to use SQLAlchemy. I tried to read about SQLAlchemy, but I didn't like that because I prefer building and executing SQL queries and creating tables in the database only. Is there any way that I can take full benefit of using Flask with MySQL Database without SQLAlchemy?
Please suggest.
You don't have to use SQLAlchemy, no. You just have to connect to the database in Flask and execute your queries manually.
This question is about how to connect to MySQL with Python, and the official docs go over creating a site with a SQLite database. Modify the examples provided there with your MySQL connection.
Related
I've built 2 websoftwares one with .Net and MSSQL server, the other with Django and MySQL. Now I want to transfer datas which falls in MSSQL to MySQL automatically. Is it possible to build an API for that?? I've no idea how to do it. Thanks in advance.
I want to deploy an application with sqlite3 as the database on Heroku. However, it seems to be that Heroku doesn't support applications with sqlite3 as the database. Is it true? Is there no way to deploy my sqlite3-backed application on Heroku?
PS: I have successfully deployed my application using PythonAnywhere, but would now like to know whether there's any possible way to deploy it using Heroku.
As Heroku's dynos don't have a filesystem that persists across deploys, a file-based database like SQLite3 isn't going to be suitable. It's a great DB for development/quick prototypes, though.
Heroku do have a Postgres offering however that will suit - with a free tier and a basic $9/month tier that are good for hobby/small projects. The biggest benefit over SQLite is that you get backups that you wouldn't get otherwise (plus all the other Postgres features).
There's a guide to updating your settings.py to use Postgres here: https://devcenter.heroku.com/articles/getting-started-with-django#django-settings
Heroku has a detailed article explaining "Why is SQLite a bad fit for running on Heroku" https://devcenter.heroku.com/articles/sqlite3
I am working on an django project. I am trying to connect django with a redshift database using postgresql_psycopg2 backend of django.
I am not able to migrate my database.
Can any one suggest relevant solutions? It will be very helpful.
I have been searching for libraries that can handle database migration for tornado framework. How is the database migration handled in Tornado framework ?
I was working on Yii Framework before and it has a very convenient CLI tool to handle Database migration.
I am looking for something like that.
I highly recommend Alembic. It was originally written to support SQLAlchemy, but you don't need to use SQLAlchemy as long you have a relational database it supports. That said, you will need to understand SQLAlchemy Core to work with Alembic, but that is generally a useful skill to have.
I am writing a small web application using Flask and I have to use DynamoDB as backend for some hard requirements.
I went through the tutorial on Flask website without establishing sqlite connection. All data were pulled directly from DynamoDB and it seemed to work.
Since I am new to web development in general and Flask framework, do you see any problems with this approach?
No. SQLite is just one option for backend storage. SQLite is mentioned in the tutorial only for its simplicity in getting something working fast and simply on a typical local developers environment. (No db to or service to install/configure etc.)