Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [python]

Python is a powerful and ubiquitous language. When using a Python variant or library (e.g. Pandas, SQLAlchemy, pg8000, psycopg2), please include it in the tags. Questions using this tag should restrict themselves to interactions directly with the database tier. General python scripting questions should be directed to [StackOverflow](https://stackoverflow.com/questions/tagged/python)

Filter by
Sorted by
Tagged with
-4 votes
0 answers
18 views

Incorrect number of bindings supplied. The current statement uses 1, and there are 54 supplied

def add(self): con=sqlite3.connect(database=r'ims.db') cur=con.cursor() try: if self.var_cat.get()=="Select" or self.var_cat.get()=="Empty" or self.var_sup.get()...
Atittaya Parasuwanno's user avatar
-5 votes
0 answers
16 views

Notification: "No such column :name" error when adding product information

from tkinter import* from PIL import Image,ImageTk #pip install pillow from tkinter import ttk,messagebox import sqlite3 class productClass: def init(self,root): self.root=root self.root.geometry(&...
Atittaya Parasuwanno's user avatar
0 votes
0 answers
26 views

postgressql connection issues via python

I have a python code that runs simulations and writes the results to Postgres table. I have several machines on the network, But only the first one runs without any problems. other machines have ...
HakanA's user avatar
  • 19
0 votes
1 answer
38 views

After upgrade Postgres python is the same version

I upgraded my postgres from 13.5 to 16.2 version (and the RHEL from 7.5 to 8.9). The problem is, python was not upgraded. I created procedure pyver(): CREATE OR REPLACE FUNCTION pyver () RETURNS TEXT ...
Misudka's user avatar
  • 35
0 votes
0 answers
8 views

CREATE TABLE permissions required to append Pyspark dataframe to SSMS table

I am using AWS glue to extract some data from RDS, parse it into some other format and push it back to RDS. The RDS user I use has SELECT and INSERT permissions on tic.Example. However, when I try to ...
Eloy Fernandez's user avatar
1 vote
0 answers
33 views

PostGres DB is read only in pgAdmin despite successful migration into it

I have an old MS Access Database that I want to migrate to a Postgres Db hosted in a Docker environment on a Windows Server. I want to keep the MS Access Frontend, because it has some Forms and ...
lellek's user avatar
  • 11
0 votes
0 answers
49 views

Random MySql client error "got an error writing communication packets"

I have several different Linux servers running MySQL 8.0.x instances (ranging from 8.0.23 to 8.0.33). I occasionally get "error writing communication packets" from clients when connecting to ...
Alberto Pastore's user avatar
1 vote
0 answers
106 views

Railway - problems with connecting to postgres in production

Django worked perfectly locally, but had errors in production (I was using the same postgres DB and configuration). Django server, hosted on Railway gave me this: Newtorking tab in Postgres settings ...
Mikheil's user avatar
  • 11
0 votes
0 answers
18 views

MongoDB Schema Design for Branch-Specific Flower Customization without Disrupting Original Data Flow

Description: I'm working on a MongoDB schema design for a flower shop application where flowers are managed at both the company (flower type) and branch (flower) levels. Each flower type is defined at ...
user avatar
-1 votes
1 answer
51 views

How do I partition my database by rowid and query the partitions properly?

Obligatory I'm a beginner at database management. To be specific about my situation, I'm working in SQLite3 in Python as a means to an end for now for a finance project. The table is called ...
KillerDiek's user avatar
1 vote
0 answers
95 views

Writing large dataset from spark dataframe

We have a azure databricks job that retrieves some large dataset with pyspark. The dataframe has about 11 billion rows. We are currently writing this out to a postgresql DB (also in azure). Currently ...
Kyle Chamberlin's user avatar
0 votes
0 answers
28 views

Problems with minutes in timestamps when inserting data into InfluxDB via PowerShell

I am working with InfluxDB and trying to insert time series data via PowerShell. My goal is to insert data points with specific timestamps containing hours, minutes and seconds into InfluxDB. I am ...
michi's user avatar
  • 101
0 votes
0 answers
29 views

How to lock database for SELECT query?

I've a python script that uses SQL Database. I've to process folder sequentially so I've created a 2 column, first one will tell if particular folder is processed or not & second one if it's being ...
Thunder's user avatar
0 votes
0 answers
26 views

Environment Variables and MS Machine Learning Services

My apologies in advance if this is a naive or obvious question, but I am relatively new to this sort of thing. Here is my basic set up and dilemma: I have an ETL process that starts with an API call ...
Charlie's user avatar
3 votes
2 answers
278 views

How do I resolve this python runtime error in Azure SQL Managed Instances?

We recently setup a new managed instance through the program that allows you to try it for free. When trying to run the following code from Microsoft's documentation: EXECUTE ...
Joe Obbish's user avatar
  • 32.5k
0 votes
0 answers
101 views

Unable to resolve pyodbc dependency error while migrating SQL Server database to MYSQL

I am using MySQL workbench 8.0.35 to Migrate Database from SQL Server to MySQL. I have installed python 3.12.0 and pyodbc 5.0.1. When i select Start Migration in the MySQL workbench i am getting ...
pradeep3009's user avatar
0 votes
0 answers
42 views

Best way to set up tables for EOD stock database

Im a newbie with postgre, and the course I did focused on querying already existing databases, not creating a database from scratch. Im aware that using csv tables might be the best way to go for ...
AndysPythonStuff's user avatar
1 vote
2 answers
90 views

optimize insert operation in MySQL (InnoDB)

I have this table: create table tab3( id int not null auto_increment, phrase text, link_1 int, link_2 ...
moe_'s user avatar
  • 113
2 votes
1 answer
62 views

Is calling a database class on app creation correct for pooling?

Start doadmin.Database().__init__() Class class Database(object): connection = None cursor = None def get_c(self): return self.cursor def __init__(self): if Database.connection is None: ...
Corie LeClair's user avatar
0 votes
2 answers
39 views

Question about multi fields index in MySQL

I'm having an doubt about coumpound indexes in my application. My db engine is Mysql 8.0 with INNODB and my question is the following: My application has a model called Report with the follwing fields ...
Pedro Silva's user avatar
-1 votes
1 answer
167 views

Azure DB - Converting Base64 Encoded into Binary Found in Databricks Python

I am going nuts on this. We have a base64 encoded value: "+G1mQl3A30MKQsCBxMXwyMOc/AZEvpcRRI13mUOy3SNDEFjyQuVQ0UKHFsdCJ/HCQqEvuEE5Lb5AAg==" We needed decoded to binary. In python (databricks)...
Davik2001's user avatar
1 vote
1 answer
117 views

storing histogram in sqlite database

I am not a database administrator, but only a scientist who would appreciate your help in solving my issue with storing histogram data in an SQLite database. I have several of them to be stored and to ...
user41796's user avatar
1 vote
0 answers
116 views

Machine Learning Services fails from Secondary Node of SQL Failover Cluster Instance

There was a planned cluster failover to the secondary node of our FCI. Afterwards, sp_execute_external_script stopped working. Examples with error messages are below: EXEC sp_execute_external_script @...
Dave Mason's user avatar
0 votes
0 answers
52 views

Postgresql: Does execute() or fetch() download result from remote?

When getting a query result from a remote server, does the execution of the query transmit the result to the local machine, or is it buffered on remote and only downloaded when fetching the result? ...
Radio Controlled's user avatar
0 votes
0 answers
429 views

PostgreSQL Server shuts down automatically after python start

I am using the following code: def start_postgresql_server(): status = subprocess.run(["pg_ctl", "-D", fr"C:/Program Files/PostgreSQL/14/data", "status"]...
Zanam's user avatar
  • 101
0 votes
1 answer
115 views

Proper way of constructing database of historical datasets

I've been attempting to learn how to build a database of historical sports statistics using postgresql/sqlalchemy ORM the past few days and could really use some advice on approach. My use case seems ...
Nick's user avatar
  • 101
1 vote
1 answer
856 views

postgres long running copy or batched inserts

I have lots of time-series data going into a postgres DB. The time series data comes into a message queue and is read by a consumer script and inserted into the database, the data is flowing ...
Harry Lees's user avatar
3 votes
1 answer
405 views

MySQL database copy

I need to create a copy of the database in my MySQL Server using a Python program. After a little research, I found mysqldump as the better approach: import subprocess command_to_copy_db = f"...
DilLip_Chowdary's user avatar
1 vote
0 answers
472 views

Pandas to_sql and JSON data

I'm in the process of creating a Python application which takes in a JSON encoded file and stores the information in an SQLite database in memory. The JSON file in itself is essentially a Database for ...
David E's user avatar
  • 11
-1 votes
1 answer
2k views

mysql.connector.errors.ProgrammingError: 3948 (42000): Loading local data is disabled; this must be enabled on both the client and server sides

I am working on a python project with MySQL connectivity. I have MySQL as a shell, i.e.,I need to use mysqlsh command in the Terminal to use MySQL(I am using MacOS Mojave 10.14.6). I needed to use a ...
Ojasveer's user avatar
-1 votes
2 answers
257 views

Track row affected by a plpgSQL's DML from Python code block [closed]

I just wanted to know that how could I hold the value of a DML(affected rows) using python code. Suppose a DML is affecting 10 rows so how will I print it using python. db = psycopg2.connect(dbname=...
user3040157's user avatar
-1 votes
1 answer
122 views

SQL Server long term backup policy

I wish to implement a long term backup policy in SQL Server on VM, much like Retention policies in azure sql database. I have full backup once a week, diff once a day and log backup every 15 minutes. ...
EranH's user avatar
  • 1
0 votes
1 answer
117 views

Airflow to BigQueryt data load taking forever

Im currently working as a junior data engineer. My main job right now is to move data from a DB in MYSQL (which gets updated every few minutes via webhooks) and send it to BigQuery as frequently as ...
Ayrton's user avatar
  • 1
0 votes
2 answers
5k views

Get column name and column type in the same query in the correct order using psycopg2

I have a postgresql database and I am querying it using psycopg2 and I need to get the data in the correct order as in table I have found different ways to get the column names from table and column ...
john wick's user avatar
0 votes
0 answers
685 views

Remove single quote from SQL query passed as a python string

Good day. I am using flask, and I'm passing a string from app.py into a SQL database. However, Sqlite3 passed in the query along with the string, resulting in a strange result. This is the code: ...
Olamide Olanrewaju's user avatar
1 vote
1 answer
2k views

Issue with idle connections/open transactions from Python to SQL Server

I am having issue with Python code leaving idle connections to SQL Server while having open transactions in them. Background Recently, we had some major blockings on the SQL Server database due to ...
Chetan's user avatar
  • 11
0 votes
1 answer
136 views

Advice for applying locks in my data processing pipeline

I currently have a Python program that enters rows into a Postgres table that essentially works as a list of data I need to process. These processes create on-disk files and trigger other behavior so ...
Pensw's user avatar
  • 1
1 vote
0 answers
30 views

Migrations spreading to the wrong database (local environment)

I am working on one Flask project and one Ruby on Rails project, both using Postgres. When I migrate in Rails, the changes are implemented both in this database and in the database for the Flask ...
пaean's user avatar
  • 11
0 votes
1 answer
2k views

error [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified when import excel data to sql server

I work on SQL server 2017 I need to import data from excel 2016 to sql server 2017 I using python script to do that I create odbc and success test with name Testserver path G:\ImportExportExcel have ...
user3223372's user avatar
0 votes
1 answer
589 views

IIS web application access SQL DB as service account

I've setup a new Python site on iis using FastCGI handler. The site has windows authentication enabled in iis and the app checks that the AD user belongs to an active directory group when they access ...
DeadlyDan's user avatar
  • 111
-1 votes
1 answer
498 views

Mysql takes longer when using php or python compared to worbench queries

Versions: MySQL Community Server: 8.0.16 in Windows server (Configuration file: unknow) Workbench: 8.0 Problem: When I make a query through workbench, it takes 1 second but when I make a query through ...
Ignakal's user avatar
-2 votes
2 answers
12 views

4 Rows in to 2 two with similar column attributes

I have this table: Pincode1 Pincode2 City 32417 0 Hyd 67812 0 Ban 0 72407 Hyd 0 77113 Ban I want result like this table: Pincode1 Pincode2 City 32417 72407 Hyd 67812 77113 Ban How can I do ...
Maheshwar reddy .M's user avatar
1 vote
1 answer
2k views

UPDATE incredibly slow on small PostgreSQL query - EXPLAIN ANALYZE causes it to hang

I'm trying to debug a very slow UPDATE query in one of my tables. The table name is beepers. It has 2486 rows and weighs 1204 MB. It has 18 columns and two indices: one on id and the other on ...
R. Gosman's user avatar
0 votes
1 answer
2k views

I get the error "(psycopg2.OperationalError) FATAL: role "wsb" does not exist", but the user does exits

I am trying connect to my postgress database using SQLAlchemy. I was working fine yesterday (01/27/22). Now I get the following error: sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) ...
W. Hunter Giles's user avatar
0 votes
1 answer
3k views

Copying a PostgreSQL schema and its data from one database to another

I am trying to copy a PostgreSQL schema and it's data from one database to another without impacting the availability of the current schema (old_schema). I would also like to do this for a specific ...
scrollout's user avatar
  • 103
0 votes
1 answer
477 views

formating dot commands in sqlite3

My first SQL database im using sqlite3 in idle on linux. Everything is working fine but I want my table to display in an easier to read format in the terminal. been reading about dot commands eg .mode ...
dogfood's user avatar
1 vote
1 answer
2k views

How to call python file in repo in databricks from data factory outside DBFS?

In Azure Databricks I have I have a repo cloned which contains python files, not notebooks. In Azure Data Factory I want to configure a step to run a Databricks Python file. However when I enter the /...
Brendan Hill's user avatar
0 votes
0 answers
102 views

Is this database correctly structured?

I am in the process of converting a bus timetable to a database structure. I am building a free mobile app for a specific itinerary in my country that will: let users know when their next bus is due ...
Steffan's user avatar
  • 101
0 votes
0 answers
219 views

load large data and split and store into two tables in sql server

I need to take large amount of data from a table and split that into two different tables in databse (sql server). How it is possible. i need to automate this action either in sql server side or ...
vishnu padmanabhan's user avatar
1 vote
2 answers
4k views

What is the proper way to handle multithreading insert

I'm a newbie on Database and for now I need to work with MySQL to build a web server. In a word, I have a web framework, developed with Python. It will read/write data from/into MySQL. For now I don't ...
Yves's user avatar
  • 121

1
2 3 4 5 6