Questions tagged [python-sql]

python-sql is a library to write SQL queries in a pythonic way.

python-sql is a library to write SQL queries in a pythonic way.

11 questions
16
votes
6 answers

Character set 'utf8' unsupported in python mysql connector

I'm trying to connect my database to a python project using the MySQL connector. However, when using the code below, import mysql.connector mydb = mysql.connector.MySQLConnection( host="localhost", user="veensew", …
Veen
  • 163
  • 1
  • 1
  • 5
2
votes
1 answer

How to execute query formed by python-sql query builder?

I am using the python-sql query builder to build queries. Below is the link: https://pypi.org/project/python-sql/ How do I execute queries from this query builder? Below is an example: user = Table('user') select =…
1
vote
1 answer

Count with limit and offset in sqlite

am am trying to write a function in python to use sqlite and while I managed to get it to work there is a behavior in sqlite that I dont understand when using the count command. when I run the following sqlite counts as expected, ie returns an…
user169808
  • 503
  • 1
  • 6
  • 27
1
vote
1 answer

Python-sql, using documented example but get 'No module named 'sql.aggregate' error

I want to use python-sql as per this link. python-sql project home. I install sql using "pip install sql", and it goes as planned. However, when I place the import at the top of my module; from sql import * from sql.aggregate import * from…
SteveJ
  • 3,034
  • 2
  • 27
  • 47
0
votes
0 answers

Is there a way I can match the records from sql database to tkinter entry text?

"Recently, I was working on a project to learn more about the SQL-Python connector. In this project, I created a simple Tkinter login page to enter usernames and passwords. Additionally, I set up a database containing various usernames and…
Zakii
  • 1
  • 1
0
votes
1 answer

I have problems finding a solution about how to assign different descriptive names to a Combo box values in my Python - SQL project

I am currently working on a project, a windows operating system software created using python/SQL. Basically, the GUI of the software has features to add, remove, modify and search users that are being stored into a local MySQL database. The…
0
votes
1 answer

PeeWee ForeignKeyField error. IntegrityError: (1215, 'Cannot add foreign key constraint')

I have code like below: import datetime import peewee as pw import os my_db = pw.MySQLDatabase(database=os.getenv("DB_NAME"), host=os.getenv("DB_HOST"), port=os.getenv("DB_PORT"), user=os.getenv("DB_USER"),…
EzyHoo
  • 301
  • 2
  • 14
0
votes
1 answer

SQLGlot is throwing an errow when trying to parse a parameter in a SQL statement, i.e "{{parameter}}"

Example query: SELECT * FROM table WHERE parameter is {{parameter}} It's throwing a sqlglot.errors.ParseError. Is there an option to enable this type of option/parameter interpolation, as found in Databricks SQL queries for example? I want to be…
-1
votes
1 answer

Unable to import name 'create_connection' from 'sql'

I am trying to use Flask on my pc but I keep getting an error whenever I import from the sql module. The error states: ImportError: cannot import name 'create_connection' from 'sql' (C:) # Imports import flask from flask…
-2
votes
2 answers

Which is fastest way to update rows by id in sqlite python?

I'm using python sqlite3 package to maintain mid-size project containing more than 5 mil rows. At some moment I have to use external databases, that should update my rows by same id. Using classic cursor.execute taking so long time to execute so...…