Questions tagged [python]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

How to increase idle time of “LaunchPad” for SQL Server external scripts?

sp_execute_external_script can take a while to initialize when not run for a short time. How do I set the idle time on the controller Launchpad process to keep it from shutting down too soon? Note I ...
0
votes
1answer
58 views

How to Bulk Insert sqlalchemy subclasses

I am trying to bulk insert SQL-Alchemy Subclasses into the parent table and their respective tables ie fruits tables -> Apple Table and so I insert a table of APPLE and it will insert both the row ...
0
votes
0answers
52 views

operand should contain 1 column Use Variables in SQL statement in Python

Trying to insert four columns and multiple rows with variables. The table in mysql has 8 columns in total. Four columns to insert is as following: report_type= tuple(("ada","asda","frfe","adaaa","...
0
votes
1answer
93 views

Psycopg2 Errors on SQL statement when trying to copy data from CSV file into PostgreSQL database

I am not a developer or PostgreSQL DB admin, so this may be basic questions. Logistics: Windows 10 server / pgAdmin 4 / Postgres 10 / Python 2.7.13 I'm using a python script to ingest external data, ...
0
votes
0answers
10 views

Reconstruct folder hierarchy in JSON format from MySQL using Python

I have a table with a structure like this: | itemID | parentFolderID | folderName 1 0 folderA 2 1 folderB 3 1 ...
0
votes
0answers
21 views

which python version is required to install plpython3u of which postgresql version?

I want to know if there is a reference table or trick to find out which python version is required by plpython3u of which version of postgresql . example python 3.4 is required for plpython3u of ...
1
vote
0answers
13 views

Custom Export from power BI service

I'm trying to make a custom button that exports filtered tables to a csv and downloads them to my computer. I am aware that you can do this with the '...' button but this functionality is for other ...
0
votes
0answers
9 views

Changing Cube Max Dimension

thanks in advance for any help. Python/postgres noob here. I need to change the default dimension for cubes in postgres. I tried to download source code, fixing the cubedata.h file to change max ...
0
votes
1answer
44 views

MySQL: columns with mixed character encodings, and finding columns which have multibyte data

I have some rather large CSV files that I am loading into my MySQL 5.7 database. The files are several gigabytes in size, several million lines long, and have large column widths that must be used in ...
0
votes
0answers
191 views

psycopg2.pool.PoolError: trying to put unkeyed connection

I'm trying to get connection pooling to work in my Python Flask web application. The code I am using is as follows: from contextlib import contextmanager import logging from psycopg2 import pool, ...
3
votes
0answers
67 views

TCP Resets when using psycopg2

I'm trying to do a simple health check for keepalived and other services via a python script and psycopg2 library. All seems to be alright, until I close the connection, at which point a packet with ...
0
votes
0answers
42 views

Designing a table with precalculated team values for fast read queries

My version of PostgreSQL is 10.7. As it's something I can't calculate on the fly due to the amount of times it might be used, I decided to store all the 11 million combinations and their result on a ...
0
votes
1answer
271 views

Comparing multiple tables in Sqlite 3 using python:

I am quite new to SQLITE3 as well as python. I am working on a project where I have one database with about 20 tables inside of it. One table is for user input and the other tables are pre-loaded with ...
0
votes
1answer
163 views

django_session table killing my MySQL server and django app

I need your help I hav a Django app that is about 7 years old and have been degrading now..every time the website goes down and back up and the issue is with mysql server Usually i need to just ...
1
vote
1answer
62 views

No output when use pymongo watch()

I try to access real-time data changes with pymongo.mongo_client.MongoClient.watch(), code example (Python 3.5.3, pymongo==3.7.2): from pymongo import MongoClient DB_CON_STR = "mongodb://10.10.10....
0
votes
0answers
22 views

PostgreSQL Function not returning message in Python 2.7 Script using EXCEPT NOTICE

I was not able to make the PostgreSQL function return the raised message in the Python script it was being called from. The scenario I wanted to make was:- 1) If the first table was created, a ...
0
votes
1answer
61 views

write csv file only after SQL table update, insert, delete

Objective: Write csv file of updated data from sql table only after SQL table update, insert, delete. I've read from the community that I should not do triggers to execute python. I should not run ...
3
votes
1answer
138 views

When I run mssql-cli, I get “No module named mssqlcli”

I just installed mssql-cli with pip, pip3 install mssql-cli Then I try to run mssql-cli and I get $ mssql-cli /usr/bin/python: No module named mssqlcli
1
vote
1answer
32 views

How to point SQL Server Python to a specific Python install?

SQL Server 2017 installs an instance of Python to "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\PYTHON_SERVICES" (documentation link) that it uses for its Python calls. This is installed ...
0
votes
0answers
30 views

Skewed timestamp variation

I use InfluxDB as a time series database. It is quite nice to play with that type of infrastructure. However, I faced an annoying problem I don't know how to solve it. It seems hard to query the ...
0
votes
1answer
82 views

Find and Insert Missing data in Mongodb Collection

I want to write python3 code to check and insert missing data. My MongoDB collection documents have one field named "height" which is BTC block number. I want to traverse in a range start to the ...
1
vote
0answers
203 views

PGPool II + Django w/ psycopg2 load balancing

I've a pool of applications running django 1.6 with psycopg2 on top of a PGPool II with two backends PostgreSQL servers. But all queries (read and/or write) are going to master PostgreSQL even SELECT. ...
1
vote
2answers
189 views

MySQL HA_ERR_LOCK_WAIT_TIMEOUT ignoring innodb_lock_wait_timeout (deleting most of a table)

I am issuing some long-running delete queries to some databases, and I am getting the following error: Last_Error: Could not execute Write_rows event on table DATABASE.TABLENAME; Lock wait timeout ...
1
vote
1answer
134 views

MS SQL 2017 Batch insert performance degradation

This one's a bit strange so bear with me: I'm seeing extreme insert performance degradation after an insert was interrupted in a dirty fashion (the transaction was not committed and the connection ...
0
votes
1answer
122 views

Python SQLite3 horizontal partitioning by string column

I have a 30 GB SQLite 3 database with a table containing 25 million rows. I want to group the table by a string column and create a new table for every group of records, named after the string and ...
0
votes
1answer
876 views

Query using $gte and New Date() working in MongoDB shell but not through python pymongo

When I run the following in the mongodb shell, it returns the correct number of records: (searching for the matching "SourceName" within the last 8 days) mongos> db.fdl.count({ SourceName : "SRC1"...
1
vote
0answers
90 views

Cassandra pool warning displaying continuously

I am using the Cassandra driver for python in Spyder. I am trying to fetch some data from Cassandra table. Here is my code: from cassandra.cluster import Cluster cluster=Cluster(['some_ip']) session=...
0
votes
1answer
186 views

get row/value by primary key number

I'm writing my own python wrapper on top of official mysqldb connector. I'm trying to design method that would dynamically extract row data knowing KEY ID. SELECT * FROM cameras; +----------+--------...
1
vote
0answers
49 views

MySQL Shell Python Client library

Is there a python client library available to interact with MySQL Admin API and to do similar stuff that MySQL Shell does. From the documentation of MySQL Shell, I could see that there is a --py mode ...
2
votes
2answers
75 views

Allow only one reader to a table

I have a simple Postgres table which port numbers to listen on. If one port is used it can't be used again. However due to multiple worker/threads they many times read simultaneously. I want that ...
0
votes
1answer
58 views

MySQL 'generator' not closing connections

I have the following function which is leaving connections open but I can't figure out why. The Cursor class creates a python-generator type function, allowing me to iterate over millions of rows. ...
1
vote
0answers
113 views

PID from pg_backend_pid () does not exist in pg_stat_activity

I have a software written in Python which accesses a postgres database. In order to allow several instances of the software, on one of the screens I need what is the connection identity so I check the ...
0
votes
1answer
1k views

How can I disable database lock in sqlite with python?

I made a application in python and it should read and write simultaneously in multiple instances(multi CMD widows)(multi-threading). each thread is configured independently so it will not change the ...
0
votes
2answers
369 views

0kb backup using mysqldump

Same question has been asked here but its not helping me out. In my python utility, I'm trying to take MySQL database backup using mysqldump. It runs successfully but I'm getting 0kb file in my ...
1
vote
1answer
570 views

Python version issue on Cassandra 3.11.2

Searching around I found a lot of thread about this problem (coming from 2012) but I can't find an official solution: running cqlsh.bat File "C:\apache-cassandra-3.11.2\bin\\cqlsh.py", line 146 ...
0
votes
1answer
323 views

Python code in T-SQL environment gives “access a socket in a way forbidden by its access permissions” Error

Help on the following please. I have this code Python Code import requests r = requests.get("https://www.google.com") r.status_code print(r.status_code) print("Python Rawks!!!!!!") which ...
0
votes
1answer
135 views

Do I have to commit after an exception has been raised?

My database generates a lot of orphan pages, and I'm trying to figure out why. I often do this in my python code, using the fdb driver: cursor = connection.cursor() for item in list: try: ...
1
vote
1answer
207 views

ibm_db on HADR primary database?

Yesterday I discovered a peculiar thing, it looks like a bug but I'll post it here in case someone seen it before. Testscript: #!/usr/bin/python import sys import getopt import re import os import ...
2
votes
1answer
94 views

Fetch Only new data from auto-updating online sql database

I have an online MySQL (presto) database which keeps on auto-updating (i.e., new rows keep getting added to the tables(views, to be exact) every day). I want to fetch the data from it every day but ...
0
votes
1answer
4k views

How to set a auto-increment value in SQLAlchemy?

This is my code : class csvimportt(Base): __tablename__ = 'csvimportt' #id = Column(INTEGER, primary_key=True, autoincrement=True) aid = Column(INTEGER(unsigned=True, zerofill=...
1
vote
1answer
228 views

Have several 128 elements lists, need to obtain distance between them

Is storing them in a CUBE type field and then getting euclidean distance, (using <->) the only way? I can not save them as a list of floats, since i get: "can't adapt type numpyndarray" Can ...
0
votes
1answer
79 views

Absolute beginner needing some help with PostgreSQL and Python [closed]

I am primarily a developer, with very little experience around databases, and this is my first time using PostgreSQL. I am using Python 3.6 and PostgreSQL with Psycopg2. After a user enters a ...
4
votes
1answer
453 views

Flask mongodb assertion 13 not authorized for query on flask_session.sessions

Need help resetting mongodb back to its original state. We have a flask app running with mongodb with authentication turned off. Running on Ubuntu with std Flask. We tried ALL sorts of combinations ...
0
votes
1answer
360 views

python ibm_db driver and decimal values?

It appears as if decimal values are treated as strings by ibm_db. Small example: Python 2.7.14 (default, Mar 14 2018, 13:36:31) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)] on linux2 ]$ cat aa.py #!/...
0
votes
1answer
481 views

How to start LaunchPad service of SQL Server on Ubuntu?

I'm running SQL Server 2017 on Ubuntu 16.04. When trying to run an external Python script, I got the following error: Msg 39011, Level 16, State 1, Line 0 SQL Server was unable to communicate with ...
0
votes
2answers
3k views

Reading from Postgres SQL in a Jupyter Notebook [closed]

I am trying to read data directly from Postgres to my python environment with the below: import psycopg2 as pg import pandas.io.sql as psql conn = pg.connect(database="abcd",user="postgres", password=...
1
vote
2answers
442 views

Database Stuck in “Restoring” in SSMS After Running From an Outside Process

I am running a RESTORE DATABASE procedure with RECOVERY and REPLACE from an outside process (Windows Batch using a Python script) and when I do so, it makes my database stuck in "Restoring..." mode ...
0
votes
2answers
80 views

How to filter splitting a column value?

I´m a newbie in the SQL world and I code with just the simple insert, select, delete and update. So... I have a table with a column named "market" that has a list of cryptocoins... like this... ...
0
votes
1answer
44 views

How to perform multiple selects without using for loop

I am querying for ids using a for-loop. So multiple selects are being used. Is there a better way to do this to have a single select statement for all ids? for id in aoi_ids: sql = """SELECT id, ...
1
vote
1answer
742 views

Calling MySQL stored procedure in python with field names

I am trying to call a MySQL stored procedure that returns a single row, I can get the values back back using cursor.callproc() and cursor.stored_results(), but I can't get name of the field back '...