MySQL: Get column name or alias from query

I'm not asking for the SHOW COLUMNS command. I want to create an application that works similarly to heidisql, where you can specify an SQL query and when executed, returns a result set with rows...

escaping special characters using sqlalchemy

I'm storing filenames and filepaths in mySQL. Retrieving them from the database using the LIKE expression requires that I escape all allowed filename chars that collide with mysql special chars. ...

Replacing Pandas or Numpy Nan with a None to use with MysqlDB

I am trying to write a Pandas dataframe (or can use a numpy array) to a mysql database using MysqlDB . MysqlDB doesn't seem understand 'nan' and my database throws out an error saying nan is not...

django test app error - Got an error creating the test database: permission denied to create database

When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname I get this error: Creating test...

OperationalError: (OperationalError) (2003, "Can't connect to MySQL server on '192.168.129.139' (111)") None None

I am trying to create a remote database using mysql on an Ubuntu machine running 12.04. It has a root user with remote login enabled and no password.I have started the server. output of sudo...

Python: Proper way to store list of strings in sqlite3 or mysql

I'm trying to store a list of string values into a sql database. list = ['please','help','me'] I've tried converting to unicode and using the array.array('u',list) unicode_list =...

Sorting very large mysql table and writing to file

I have a very large table that I'm trying to sort and write to file with the query: select * from t1 order by user_id,tstamp into outfile 'sample.tsv'; The table is quite large (on the order of...

How to return str from MySQL using mysql.connector?

I'm trying to use MySQL Connector/Python from mysql.com with Python 3. I have tables in UTF-8 coding, and when I fetch the rows, all my chars columns returned like bytearray. This is make some...

Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

I've installed Python 3.5 and while running pip install mysql-python it gives me the following error error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat) I have added...

Unable to install mysqlclient in python3 virtualenv

I want to run django with MySQL and Python 3. I initialized virtual environment with virtualenv --no-site-packages -p python3 ./. Then I installed django and wheel using pip, so pip freeze...

Python MYSQL-connector backup creation

Current Problemset: Python application including mysql_connector object Remote Server only accessible using mysql (no ssh, rsh, telnet, etc.) Target: Use mysql connector to create a database...

Error Loading MySQLdb Module and "pip install MySQLdb"

I'm trying start up a Django project. I get this error on trying to run the manage.py: (venv)dyn-160-39-161-214:proj Bren$ python manage.py Traceback (most recent call last): File "manage.py",...

I cannot install mysql-connector-python using pip

I am trying to install mysql-connector-python==1.0.12 as part of my project's automated installation, and I get the following error from pip install: Collecting mysql-connector-python==1.0.12...

SQLAlchemy automap: Best practices for performance

I'm building a python app around an existing (mysql) database and am using automap to infer tables and relationships: base = automap_base() self.engine = create_engine( ...

java.sql.SQLException: Access denied for user 'root'@'172.17.0.1' (using password: YES)

I am trying to write into a mysql database from Java but I get this error: java.sql.SQLException: Access denied for user 'root'@'172.17.0.1' (using password: YES) I am connecting to a local...

How can i create log files date wise?

I am creating logger file .now i need to create logger files based on date. my below code is creating only one log file .but i need to create a new log file date wise.am not getting any idea how...

InterfaceError: 2013: Lost connection to MySQL server during query

When I'm trying to connect to the MySql Database server in Python on Google Cloud Platform, I'm getting the error. The following is the actual code. import mysql.connector import pandas as pd cnx...

django.db.utils.OperationalError: (2005, "Unknown MySQL server host 'db' (-2)")

I'm trying run django with mysql in docker containers: version: '2' services: db: image: mysql:latest volumes: - ./db:/var/lib/mysql ports: - "3306:3306" ...

Character encoding error when writing url in FPDF2

I'm working in Python 3.7 and have the python port of FPDF 2.0.3 (https://pypi.org/project/fpdf2/) running. I'm working with a lot of unicode symbols, and some of them need to be a part of the...

Install from pipfile using pipenv install gives error

I have a project where I'm trying to install from the pipfile using pipenv install. I get som error when installing. Before i describe the error, this is what I did: Reinstall pipenv Reinstall...

How can I write a delete postgresql query in Python flask

I was trying to delete from a database table using flask and postgresql, but I keep having error in mysql syntax.Please how can I implement it. The two ways below did not work. Nb: The id is to be...

Database Permission denied after running docker-compose up

I'm getting the following error after I run docker-compose up. How do I resolve this? db_1 | chown: changing ownership of '/var/lib/mysql/': Permission denied db_1 | chown:...

Why BINARY usage in SQLAlchemy with Python3 cause a TypeError: 'string argument without an encoding'

I read a lot of similar questions but none of the clearly answer my issue. I'm using sqlalchemy-utils EncryptedType on a mysql table column. The table creation and the insert is ok, but when I'm...

Python MySQL ReferenceError: weakly-referenced object no longer exists

I want to connect to a mySQL Server and get all users from the users table. But if i try to execute my code, it says: /bin/python /home/luca/PycharmProjects/Test/sql.py Traceback (most recent call...

How to terminate complicated queries to database from python?

I want to integrate MS-SQL with pandas dataframe over python library SqlAlchemy. Ther's nice way to do this by: import sqlalchemy as sa import pandas as pd conn_string= 'DRIVER={ODBC Driver 17...

Heroku SSL connection error unsupported protocol

I have been using Heroku for a while to host my Discord bot. It has been connecting to a MySQL database hosted on ClearDB successfully. However, very recently, whenever I use the bot and it tries...

TypeError: connect() argument 4 must be str, not WindowsPath . /*The Error that i m getting in my simple login django project*/

System check identified no issues (0 silenced). You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes,...

Using apache-airflow-providers-snowflake on airflow (no module named Snowflake)

I have installed package apache-airflow-providers-snowflake on airflow on docker and i am getting error No module named Snowflake Please refer attachment (check the error mentioned for the...

lower_case_table_names error for Docker + MySQL 8.0.26 based project on Ubuntu 20.04 Server(AWS EC2)

I am trying to configure my Django + MySQL(8.0.26) project on Ubuntu 20.04 based AWS EC2 server with Docker Compose. However, MySQL database container is not working because of...

Cargo test--failed to run custom build command for `ring v0.16.9`

I am trying to compile a Rust project on Windows by using Visual Studio code. But the compiling has error. I have double checked my cargo version which is the latest. C:\Users\Lenovo>rustc -V ...