1

I have my data in database, and I want to build an API using python to query the database. What do I use or where do I even start ?

I can connect to my database and pull the data. But I do not know how to build an API for other users to query the database

  • Lots of people like to use this: https://github.com/PyMySQL/PyMySQL – Rob Bricheno May 25 '18 at 14:17
  • 1
    http://idownvotedbecau.se/noresearch/ You are saying that you could not find a way to return data from a MySQL database using Python? As for where to start, you can copy/paste your post title into Google. – dfundako May 25 '18 at 14:18
  • Possible duplicate of [How do I connect to a MySQL Database in Python?](https://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python) – dfundako May 25 '18 at 14:19

1 Answers1

0

NOT a trivial solution, but worth looking into, depending on how big a project this is and what else you may want to do with Python and MySQL.

Django is a framework for Python that can handle a lot of things but, most importantly, provides a very powerful interface to MySQL and other databases.

One of the many add-ons for Django is Django REST Framework which is specifically designed for setting up Restful APIs using Django & Python.

I have used Django & Django REST Framework extensively. It can take a while to get up to speed, but I think still a lot less work than if you were to take a basic connector between Python & MySQL (having to code SQL statements manually) and code the API interface at a lower level (Django REST Framework isn't perfect but it takes care of a lot of the details).