The python tag has no usage guidance.
-1
votes
0answers
16 views
The server how to store a mockup route on the database with the polyline, starting point, end point and, duration [closed]
I used remote server, postgresSQL and Python languge, Ihave created tables.but how to store a mockup route in the database, i do not know, please teach me.
1
vote
0answers
21 views
Import Data From csv Into Postgresql WITHOUT COPY
I am writing a function for a python environment which needs to import data from a csv file into an existing table. The scope in which the function can execute does not allow for a db SUPERUSER to run ...
2
votes
3answers
215 views
SQL Server backup. PowerShell vs Python [closed]
I'm about to refactor inherited scripts deployed on multiple servers that backup many other servers. They are a mixture of cmd, vbs and sql. I'm pondering what benefits would bring doing it with ...
0
votes
0answers
7 views
Persistent Failure to Import Table from one Postgres db to another
I need to move or copy the data in a table to a similar table in another database. Both databases are on my local machine, which is running Postgresql 9.4.8. I am on Ubuntu 16.04. The databases were ...
0
votes
1answer
45 views
BULK INSERT: Trials and Tribulations
I recently ran into several problems with a BULK INSERT task, so I thought I'd share my experiences. I'm not looking for help, just offering help for others that may experience something similar in ...
1
vote
1answer
23 views
Database Error relation does not exist [closed]
I am trying to perform the seemingly simple, even routine task of importing a TSV file into a Postgresql 9.4 database table.
2 Questions:
Why can't it find this table, and
Why is it telling me it ...
0
votes
0answers
13 views
insert error: (1064 … from python script importing into sqll workbench
This is the piece of code that is getting the error. I'm trying to parse through a table and check for Primary keys using the code below. If the the key exists, it won't insert the data etc.
...
0
votes
1answer
18 views
Create simple database with secure data entry GUIs [closed]
I need to create a relatively simple database management environment with a secure graphic user interface, including forms, for data entry. In my co What has been used since to fill this need is an ...
2
votes
1answer
48 views
Query against JSON array in PostgreSQL
The data I'm working with is in a column ('transaction') of JSONB type, containing documents similar to this {"transactions":[{"id":"ABC123", ...}, {"id":"DEF456", ...}, {"id": "GHI789", ...}]}
I'm ...
0
votes
1answer
31 views
Booleans, CONSTANTS or mapping table for 'status'-like fields?
I am modelling a User table which needs to have the following information about the users:
is_active?
is_detained?
has_voluntarily_deactivated?
is_temporarily_suspended?
and so on...
Basically, ...
0
votes
1answer
23 views
use sql or scripting language to do analysis in a database
More of a general question but is it more efficient to write python code to run mathematical analysis or complex queries in sql itself. What is considered best practice.
0
votes
0answers
42 views
incremental backup Mongodb from oplog
I was trying to take backup using oplog based on ts using below code
import pymongo
import traceback
from pymongo.cursor import CursorType
c = pymongo.MongoClient('mongodb://localhost:...
0
votes
2answers
80 views
mysql error 1265 data truncated for column
I created a table in mysql like this :
create table if not exists data
(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
execute_time DATETIME NOT NULL default current_timestamp,
db VARCHAR(25) NOT NULL,
...
0
votes
0answers
54 views
MongoDB avoid $sort + $limit optimization
In my Django app using mongoengine I've got such code:
art_cursor = Articles.objects.aggregate({'$match': {'ntype': {'$in': [1,6]}}},
{'$group': {'_id': {'title': '$title'}}},
{'$sort': {'_id....
1
vote
1answer
27 views
Run lo_export as client through psycopg2
Python 2.7
psycopg2
When I run:
cur.execute("SELECT lo_export(123456, '/tmp/test.jpg')")
Produces error - need to be superuser to do this.
This makes sense as it is running a server side ...
1
vote
0answers
175 views
postgresql Idle for transaction while migrating 30GB database
I'm migrating part of a mysql database into a postgresql database with a different Schema.
I've written a python script, using mysql-connector and psycopg2 modules. It takes care(should) to convert/...
1
vote
1answer
45 views
MySQL: database setup to properly deliver non-ascii characters
I'm facing the following problem: I have a MySQL database which contains non-ascii characters in some records. Characters like "ñ", for example.
What kind of setup do I need to perform at the ...
1
vote
2answers
416 views
How to restore postgres database which is created using pg_dumpall?
I have dumped all of my databases using pg_dumpall and now I want to restore them. I used the command psql -f db.out postgres, but I am still not able to see my databases.
Can anyone help?
1
vote
1answer
67 views
Design db schema in correct way for parent child kind of requirement
I am creating schema of tables. But not able to understand best way to do it.
Following are the tables:
Car Model - It contains all car models with types. For eg. Mercedes(brand) - GLA 250(...
0
votes
1answer
320 views
Can't connect to ODBC database with pyodbc. Which SQL Server driver should I install on the Raspberry Pi?
I'm trying to connect to a SQL Server database using a python script. I'm using the pyodbc library to connect to it.
cnxn = pyodbc.connect('DRIVER={SQL Driver}; SERVER=192.168.80.30 ;DATABASE=users;...
1
vote
0answers
71 views
Redis along with Mysql
I'm currently working on a mobile app alike Google Maps or Wave, but also including parking. The application its running with MySQL primarily. With at this stage most of our data is loaded by python ...
0
votes
0answers
13 views
Inserting data from external PC faster than from localhost
I've been benchmarking the performance of a new virtual server in order to find out the best engine and database structure for my setup.
Currently I am using python with mysql-connector both on the ...
0
votes
1answer
97 views
Select after an Uncommited Update in Python-MySQLdb
May be this is a newbie question but want to confirm as this is important for my app:
I'm using MySQLdb on Python and my code looks like:
db = MySQLdb.connect("localhost","root","",test)
cursor = db....
7
votes
1answer
1k views
Why is PL/Python untrusted?
According to the docs:
PL/Python is only available as an "untrusted" language, meaning it does not offer any way of restricting what users can do in it and is therefore named plpythonu. A trusted ...
3
votes
0answers
35 views
Should I do the maths within PostgreSQL for ACIDity?
It is my first question on Database Administration Stack Exchange. Please be kind if something is not done the nice way..
I would like to be advised concerning the way I'm working on my database, in ...
0
votes
2answers
40 views
Database view listing distinct days
I have a list of sensors of many machines, that stores on a second base (i.e., 86400 records each day for each machine). One of the many columns is the datetime of the value (that can also be stored ...
1
vote
1answer
46 views
select two tables and print the columns side by side with matching key in hive
I have the below tables:
table_1
name_1 id_1 value_1
avi 1 21
adi 2 X
table_2
name_2 id_2 value_2
avi 1 21
adi 2 22
metadata_info: can be read from ...
1
vote
0answers
19 views
Heirarchial Database with Time Tracking
Working in Python/Django 1.8
I have a problem along the following lines:
Assembly Table
|Part
|Parent (FK to other Part)
i.e.:
Car
|--Tire
|--Bolt A
|--Bolt B
Journey Table
|Date
|...
0
votes
0answers
9 views
How to load a .dmp into PostgreSQL using pgadminIII [duplicate]
I have a dump file from oracle that I wish to load into pgSQL database.
I can use psycopg2 or pgAdminIII to accomplish this. Any tutorials or references would be much appreciated as I cant seem to ...
0
votes
2answers
329 views
SQLAlchemy connection error with Postgres
I am trying to write a basic python script that uses SQLAlchemy to connect to my Postgres database. In the connection details, if I use "LOCALHOST", it connects fine. If I reference the server by name,...
0
votes
2answers
115 views
How to add new columns to MySQL database retaining existing data?
In implementing upgrades to an existing Python application, on a development server, one MySQL table has gained an additional column but another has gained 23. What is the best way to add these to to ...
0
votes
1answer
125 views
mysql to postgresql, migrate files directly ( longblob > pg_largeobject )
I'm working on a python(2.6.6.) script and I'm evaluating what approach to take to migrate files from mysql-server to PostgreSQL . I've read the following posts:
How to insert (file) data into a ...
0
votes
0answers
220 views
psycopg2 - drawbacks of reusing cursors?
I am new to Python and the psycopg2 module.
context
Working on a script that select data from MySQL, perform some operations (conversion of data-types and other "transformations"), and finally ...
0
votes
0answers
105 views
No foreign key constraint with PRAGMA foreign keys
This is my code. It's SQLITE3 in Python 3.
conn = sqlite3.connect(db)
c = conn.cursor()
c.execute('BEGIN')
c.execute("PRAGMA foreign_keys = ON")
c.execute('CREATE TABLE Product(...
1
vote
1answer
1k views
SQL Server: how to troubleshoot login timeout expired error [closed]
I have a production SQL Server 2012 (SP1) running on Windows Server 2008 R2 Enterprise edition.
A lot of time while connecting to this server from a remote host I to face connection timed out error. ...
0
votes
1answer
38 views
plpy.execute('…') statements not in logs
How can I get the SQL statements executed by plyp into the postgres log files?
CREATE FUNCTION history_monitor() RETURNS trigger
LANGUAGE plpythonu
AS $_$
...
plpy.execute('...')
$_$;
...
1
vote
0answers
82 views
SQLite reference table question
I'm using SQLite and Python for making a sensor network database. I have a table holding the nodes: NODE, another 2 tables for sensor specification: SENSOR_TYPE ("Temperature, Humidity...) and ...
1
vote
1answer
408 views
How do long string field names affect MongoDB database size?
I am using MongoDB and the names of my fields are strings with 10-20 characters. A typical document consists of 30.000 columns filled mostly with floats, like 1.2, 10.5, 2.55. It's size is 1MB.
Do ...
1
vote
1answer
82 views
Looking for simple contains method when searching text in postgresql
Im new to the PostgreSQL world so I do apologize in advance for not knowing if there is an obvious answer to these questions.
Basically I'm looking for two things. First a simple "contains" based ...
3
votes
1answer
329 views
What exactly is Psycopg2?
This question is for a report I'm writing for school. Technically speaking, what is Psycopg2? In this tutorial they refer to it both as an "adapter" and "driver"
Psycopg2 is a DB API 2.0 compliant ...
6
votes
1answer
1k views
How to get minimum value in pyMongo
I have a collection with several fields, and I'd like to get the minimum value from one. I know a command for getting the max value:
collection.find_one(sort=[("myfield", -1)])["myfield"]
but not ...
1
vote
1answer
209 views
Why do the queries slow down after a few minutes, when trying to build a DB?
First - I am a complete newb to DBA. Please be gentle. (And I am fairly new to python as well.) Oh, and I have no idea how to change any MySQL settings or the like, so all the MySQL DB settings are ...
0
votes
0answers
97 views
PostgreSQL becomes very slow after heavy utilization
I have built a Python web application and I am hosting it in a 2GB RAM Debian Server. My application uses PostgeSQL 9.1 with PostGIS.
One of my tasks involves importing data from big csv files. ...
1
vote
0answers
13 views
Adding new sproc to the exisiting database using connectors?
The project I'm currently working on is mostly pythonic, by this reason I'll likely use mysqldb python connector or sqlalchemy.
The question arose when I've tried to find out the way of adding new ...
0
votes
2answers
222 views
Cassandra - save file
I'm new with Cassandra, and even more - I never have such task for habitual RDMS systems, like MariaDB or Oracle.
So, how can I store file in to Cassandra's table? Preferably using Python-driver, but ...
0
votes
1answer
276 views
What is wrong with the following Python code — trying to insert into a database?
This works in MySQL Workbench:
insert into nametest (name,surname) values('John''Krailling');
I am trying a get similar result with Pycharm with the following code:
import MySQLdb
db = MySQLdb....
0
votes
1answer
613 views
Mysql How to insert a variable as field value in a table
I have created a variable named hash as a password hash. How can this variable be inserted a a field value in a table?
hash = pbkdf2_sha256.encrypt("password", rounds=200000, salt_size=16)
cur....
1
vote
2answers
3k views
How to work with multiple Postgres databases in psycopg2
I have two different Postgres databases on two different servers (one is actually local). Similar to this question, I would like to work with both databases at the same time. However, I can't figure ...
1
vote
2answers
152 views
Mysql date_add returns wrong row in python, right row in phpmyadmin [closed]
I am trying to get the first and last record from a month. In phpmyadmin I ge the correct result. In python I don't. In fact python returns the same row for both of these queries. First number is ...
0
votes
1answer
356 views
Scale MySQL trigger for thousands of inserts per seconds
We are using MYSQL database for an Analytics app. I have two table token and token-big (for overview of actual data) both have id(int) unix_starttime(int) unix_endtime(int) details(varchar 256)
A row ...