Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [python]

The tag has no usage guidance.

0
votes
0answers
18 views

Query error when trying to SELECT data in PostgreSQL 10 [migrated]

I'm just getting started with PostgreSQL and have a bit of a problem. I am using Psycopg2 and hosting the PostgreSQL database on AWS RDS. Here is the query I am trying to execute: cursor.execute('...
0
votes
0answers
28 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
20 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
55 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
57 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
62 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
36 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
326 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
18 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
39 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
21 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
73 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
30 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
26 views

What kind of hashing should I do? [closed]

I installed the following simplechan bulletin board but md5 was used to hash passwords for administrators of this bulletin board. According to the examination I found out that md5 is very weak. So, I ...
1
vote
0answers
33 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
0answers
97 views

Extract Timestamp of latest document in MongoDB using Pymongo

I have mongoDB collection with columns filename and text I want to extract timestamp of latest document using pymongo What I Tried: from pymongo import MongoClient host = "172.0.0.1:27017" client = ...
0
votes
1answer
369 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
1answer
159 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 ...
0
votes
0answers
23 views

How to get distinct documents of user messages to different users?

In MongoDB we have distinct method that returns distinct values of a record from a specific collection: db.inbox.find({"inbox_type": "direct"}).distinct("sender") The above command returns distinct ...
0
votes
1answer
201 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
173 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
40 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: ...
0
votes
1answer
82 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
59 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
0answers
56 views

Intersystems Cache to MySQL - working (in python script), Cache to MSSQL(in SSMS) - not working

It's a question loosely related to Intersystems Cache ODBC configuration for MS SQL compatibility We're trying to find a solution and there's something that explains a lot and yet not a thing. If I ...
0
votes
0answers
72 views

How do I execute this query using SQLAlchemy?

I want to execute this query in SQLAlchemy. How do I convert it into the standard form of SQLAlchemy? insert into conform_layer SELECT primary_key, key, value FROM (select row_to_json(t.*) ...
0
votes
1answer
2k 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=...
0
votes
0answers
1k views

How to import a CSV into Postgres using Python ORM?

This is my CSV file: https://i.stack.imgur.com/5okaX.png This is my code : from numpy import genfromtxt from sqlalchemy import Column, Integer, Float, Date, VARCHAR from sqlalchemy.ext.declarative ...
1
vote
1answer
82 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 ...
2
votes
0answers
184 views

Error in request [closed]

I have the following error in mssql 2017 when I make a request EXEC sp_execute_external_script @language = N'Python', @script = N' from suds.client import Client url="http://www.google.com" ...
1
vote
0answers
44 views

exporting live data from mongodb [closed]

I am storing measures of 350 photovoltaik modules in mongodb. The following data represent the actual current of the modules. This is how I did it: { "_id" : ISODate("2018-05-20T00:00:00.000+0000"), ...
0
votes
1answer
75 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 ...
0
votes
0answers
134 views

AutoReconnect: [Errno 32] Broken pipe

I was just wondering if anyone here can help me out in fixing this issue. I am having some trouble while configuring this browser (https://github.com/macarthur-lab/gnomad_browser) on my machine. Every ...
0
votes
0answers
16 views

Selecting the right DBMS and developing a schema for multiple time series data

Preface I'm not asking this so you can do the work for me, but I'm out of keywords to google and can't wrap my head around this. I'm looking for any and all pointers towards a good solution, so ...
2
votes
1answer
269 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
206 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
292 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
2k 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
400 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
34 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
0answers
65 views

Alternative to Celery to integrate multiprocessing management

I have a queue where data are loaded, it takes about 1 minute to process over each data in queue, and I want to process them in parallel. is there any alternative for celery to handle this scenario? ...
0
votes
1answer
38 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, ...
0
votes
0answers
72 views

Postgres: high difference between “backend_start” and “xact_start” time for first connection query

From whatever connections are being created by the application layer, the first connection is taking a lot of time in execution on DB, rest of following connections are working fast. Stats from DB ...
1
vote
1answer
517 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 '...
0
votes
0answers
44 views

Custom data type vs. extra table

I am developing a Django application that consists of the core app and plugin apps. Plugin apps are meant to be installable/unninstallable. Some of that apps are going to affect the content of the ...
0
votes
1answer
1k views

Python Postgres psycopg2 ThreadedConnectionPool exhausted

I have looked into several 'too many clients' related topic here but still can't solve my problem, so I have to ask this again, for me specific case. Basically, I set up my local Postgres server and ...
0
votes
1answer
292 views

Set or limit number of connections a single pymongo client will open

Is there a way to set or limit the number of connections to Mongo a single pymongo client instance will open? I don't want to modify Mongo config to do this, because I don't want to affect other ...
4
votes
1answer
97 views

Does SSMS v17 allow user input in Python scripts?

With the introduction of Python feature shipped with SQL Server 2017, I would like to know if anyone has been able to use SSMS v17.x and run a python script that requires a user input. Here is a ...
0
votes
1answer
763 views

Size limit of MySQL database table?

I'm running a remote script that collects data from the web nightly. Each morning I import the latest data to my database on my Mac using a command line import to phpMyAdmin, adding to the number of ...
0
votes
1answer
216 views

Psycopg2 error at or near %

Note location of cursor. At first I thought it was the lack of a semi colon, but as you can see, putting one in does not solve the problem or change the error. I compared this code to samples I found ...