Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I connect to the database with pypika?

Reading the documentation it's pretty much clear how to build queries, but I couldn't find any tutorial how to connect to the database - i.e. instruct pypika which DB to use, which credentials etc. How can I connect to the database with pypika?

like image 990
user3751086 Avatar asked Apr 10 '19 08:04

user3751086


1 Answers

As far as I know, you can't connect to a database with pypika. Pypika is only a tool that makes SQL query strings. It doesn't have the functionality you are looking for.

You make the query string with the help of pypika, and you throw that string to your database system with packages that can do that, like pymysql for MySQL or psycopg for PostgreSQL.

like image 148
Ignatius Avatar answered Sep 17 '22 12:09

Ignatius