Category : pymysql

I try to get some data from mysql with python but return nan. There is my code: import csv import pandas as pd from sqlalchemy import create_engine, types from pandas.io import sql import pymysql import numpy as np db = pymysql.connect(host=’192.0.0.0′,port=0000,user=’123′,passwd=’123321′,db=’matomo’,charset=’utf8′) cursor = db.cursor() try: SQL_Query = pd.read_sql_query( ”’SELECT name FROM matomo_site”’,db ) df0=pd.DataFrame(SQL_Query, columns=[‘a’]) ..

Read more

hi guys I try to connect to my wampserver database which is running in my windows computer from my raspberry with a python code see code below import pymysql db = pymysql.connect(host=’192.168.54.12′, user=’root’, password=’NZlxqqqqqqqhGqqwwwwxFG’, database=’iot’) dbcur = db.cursor() But I can’t do it which is surprising because I gave access to my raspberry to be ..

Read more

I have a function that looks like this that I’m trying to mock. code.app.py import pymysql # conn returns a pymysql.connect connection conn = get_conn(db_port, db_username, db_name) def does_table_exist(conn, table_name): sql = f"SELECT * FROM information_schema.tables WHERE table_name='{table_name}’;" try: table_exists = None with conn.cursor() as cur: sql_result = cur.execute(sql) if sql_result == 1: table_exists = ..

Read more

guys I try to connect to my wampserver database which is running in my windows computer from my raspberry with a python code see code below import pymysql db = pymysql.connect(host=’192.168.54.12′, user=’root’, password=’NZlxqqqqqqqhGqqwwwwxFG’, database=’iot’) dbcur = db.cursor() But I can’t do it which is surprising because I gave access to my raspberry to be able ..

Read more

Hi guys I understand there are a lot of threads on this topic, however I have been unable to find anything that works and am I completely stuck. my Docker-Compose file looks like : version: "3.8" services: app: build: . ports: – 9090:5000 links: – db:database db: platform: linux/x86_64 image: mysql command: –default-authentication-plugin=mysql_native_password restart: unless-stopped ..

Read more

I’m unable to update my table in MySQL using Tkinter. It just won’t get updated. I have tried checking where the table name is different but it’s not. It shows no errors but not getting updated. from tkinter import * t = Tk() t.geometry("500×500") Label(text = ‘Name:’).place(x=10,y=10) nm = Entry() nm.place(x=55,y=12) Label(text = ‘age:’).place(x=10,y=35) ag ..

Read more

I have an error pymysql.err.InternalError: Packet sequence number wrong – got 0 expected 1 after leaving my application idle (0 requests to DB) for few hours. I thought, databases module creates connection pool (it does) and recreates connections after some timeout automatically, but it doesn’t. Requirements – Python 3.8, FastAPI, databases[mysql]. Any ideas ? main.py ..

Read more