The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
2answers
7 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
28 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....
0
votes
0answers
19 views

Create custom JSON response from PostgreSQL table

Consider the following table: CREATE TABLE IF NOT EXISTS trips ( trip_id SERIAL PRIMARY KEY, start_location TEXT REFERENCES locations(label), end_location TEXT REFERENCES locations(label), ...
1
vote
1answer
16 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 ...
0
votes
0answers
38 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
33 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
50 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
40 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
192 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;...
0
votes
0answers
8 views

Can't connect to ODBC database with pyodbc. Which SQL Server driver should I install? [duplicate]

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
43 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
9 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
62 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
32 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
37 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
28 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 ...
1
vote
0answers
18 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
217 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
74 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
87 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
126 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
71 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(...
2
votes
1answer
829 views

SQL Server: how to troubleshoot login timeout expired error

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
36 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
72 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
244 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
70 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 ...
0
votes
0answers
84 views

MySQL – Backup/Restore Selected Tables/Fields Only

I support a Python application (includes some C modules) that utilises a MySQL database. A number of clients are running this in a standalone environment but have agreed that we can use their data ...
3
votes
1answer
212 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 ...
0
votes
0answers
81 views

UPSERT-ing large batches in PostgreSQL 9.3 on AWS RDS

Consider the following location updates table , which keeps the most recent location update of each car_id. The table has the following columns: car_id - a textual primary key geom - a PostGIS ...
4
votes
1answer
723 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 ...
0
votes
1answer
166 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
89 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
12 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
127 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
225 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
526 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....
0
votes
2answers
1k 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
131 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
290 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 ...
1
vote
0answers
663 views

Creating Pandas DataFrame on Python From a MongoDB Document containing Embedded documents

I am working on a machine learning algorithm on python's scikit.learn, but this time the data are in Mongodb documents format. I would like to pull my data into a dataframe. Here is an exemple of the ...
0
votes
0answers
112 views

New Table vs Java Beans to allow user to dynamically change data representation?

I am building a database to store the assessment records of students, along with other relevant information and functionality like reporting on average scores etc. Currently my company uses Excel for ...
0
votes
0answers
100 views

MongoDB stops responding after 2 days of working

I've written small application in Python (I used Twisted). Program receives data and writes it to MongoDB. Every 2 days MongoDB stops responding: 2015-02-11T10:47:20.918+0100 [initandlisten] can't ...
0
votes
0answers
89 views

MongoDB GridFS delete operation too slow while mongod process takes up 100% CPU

I'm using Python (CPython 2.7.3 on Debian 7.8 amd64) with pymongo driver (version 2.7.2) to connect to a MongoDB (db version v2.4.12) database which has solely been used to store files in a GridFS ...
1
vote
1answer
1k views

How to take backups of MySQL databases, explicitly based on PyMySQL

I am looking for a purely Python solution to take backups of every MySQL database on localhost. I already use PyMySQL to run queries on these databases. Any help is highly appreciated. EDIT After ...
0
votes
1answer
457 views

Concurrent SELECT and UPDATE in multiprocessing python

I have to randomly match about 20 million rows in two tables without using the same row twice using PostgreSQL 9.3.5. Both tables have the following structure CREATE TABLE de_sim_points_end ( -- ...
0
votes
0answers
350 views

mongodb configuration issue

I am editing the configuration of running mongodb in an 'amazon ubuntu instance' (with more than 30 GB data), and I attached some volumes for data, log, and journal I followed mongodb-ec2: ...
1
vote
0answers
336 views

Migrate from SQLite to MySQL (then back)

For various reasons, I must use a SQLite database with a local application. However, I wrote a Flask app that enables users to more easily classify items in the database, and it runs very slow on ...