I am trying to connect to two databases using Python and, also, use tables from both of the databases. How can I do this? Is the following code correct?
con = mdb.connect(host=MY_HOST, user=MY_USER, passwd=MY_PASS, db1=MY_DB1, db2=MY_DB2)
If you don't specify the database in your connect call, you can write queries against multiple databases at once.
db = _mysql.connect('localhost', 'user', 'passwd')
SELECT u.*, i.* FROM db1.users u LEFT JOIN db2.items i ON u.id = i.user_id
To communicate any database with Python ...READ MORE
db = MySQLdb.connect(host="localhost", # ...READ MORE
It shouldn't matter whether the connection is ...READ MORE
Try doing this - It is efficient for ...READ MORE
Sorted!!!! just found the solution,
1 - apparently ...READ MORE
connect mysql database with python
db = ...READ MORE
Very similar to mysqldb but better than ...READ MORE
The connection string passed to psycopg2.connect is ...READ MORE
you are passing the parsed datetime object to ...READ MORE
Already have an account? Sign in.