Tagged Questions
1
vote
1answer
21 views
How to reuse / clone an sqlalchemy query
It seems to me like going through the whole process of creating the expression tree and then creating a query from it again is a wasted time when using sqlalchemy. Apart from an occasional dynamic ...
1
vote
1answer
13 views
How to monitor/log sqlalchemy scoped sessions?
I am working on a legacy application that uses SqlAlchemy and whose architecture is...well...suboptimal.
I recently discovered there is a lot of (unneeded) mysql connections openned by the ...
0
votes
0answers
11 views
Why SQLAlchemy Session.filter().update/delete raise read-only exception when using RoutingSession?
The following is my config, slave is read-only:
engines = {
'master': create_engine( ...
3
votes
0answers
40 views
Write-once read-only field
We need to implement a write-once (on object create) read-only field with SQLAlchemy/Elixir.
A quick-and-dirty solution:
class User(Entity):
# some fields ...
_created = ...
0
votes
0answers
20 views
Python/SQLAlchemy not updating instances with list of tuples
I've been learning to use SQLAlchemy and am trying to get it to load data already in the database, change values of the objects by adding a tuple to a list, then save/update them in the database.
For ...
0
votes
1answer
15 views
SQLAlchemy - How to Filter Properties of Related Classes During Query Without Class Reference?
I struggled with the title for this question so let me just lay out the code:
File A:
class SomeClass(Base):
__tablename__ = 'some_classes'
id = Column(Integer, primary_key=True)
...
1
vote
1answer
29 views
SQLAlchemy creating two databases in one file with two different models
I want to initialize two databases with total different models in my database.py file.
database.py
engine1 = create_engine(uri1)
engine2 = create_engine(uri2)
session1 = ...
0
votes
1answer
25 views
Enthought Traits with SQLAlchemy
The question is obvious: is it possible to use both ets Traits and SQLAlchemy for the same class? If no, what an alternative approach could you suggest?
4
votes
1answer
254 views
How to make SQLAlchemy in Tornado to be async?
How to make SQLAlchemy in Tornado to be async ?
I found example for MongoDB on async mongo example but I couldn't find anything like motor for SQLAlchemy. Does anyone know how to make SQLAlchemy ...
1
vote
1answer
34 views
Assign python Decimal objects to MySQL DECIMAL columns
I have a table "City" defined as:
CREATE TABLE `City` (
`id` int(11) NOT NULL,
`lat` decimal(9,6) default NULL,
`long` decimal(9,6) default NULL,
`lm_index` int(11) default NULL,
...
2
votes
4answers
83 views
Using sqlalchemy session to execute sql DRASTICALLY slows execution time
I have a rather long query (was 7 joins, now is 7 subselects because in raw sql 7 subselects was considerably faster-- I don't even know when the 7 joins would have finished if I'd let it run, but ...
0
votes
2answers
40 views
Warning: Data truncated for column 'src_address' at row 1
from pox.core import core
import pox.openflow.libopenflow_01 as of
import re
import datetime
import time
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer, ...
0
votes
1answer
20 views
InvalidRequestError: VARCHAR requires a length on dialect mysql
I am trying to create a remote database using mysql on an Ubuntu machine running 12.04.
It has a root user with remote login enabled and no password.I have started the server.
output of
sudo ...
1
vote
1answer
30 views
OperationalError: (OperationalError) (2003, “Can't connect to MySQL server on '192.168.129.139' (111)”) None None
I am trying to create a remote database using mysql on an Ubuntu machine running 12.04.
It has a root user with remote login enabled and no password.I have started the server.
output of
sudo ...
0
votes
1answer
13 views
SQLAlchemy not producing proper SQL statement for multi column UniqueConstraints
Below are the two different attempts I have made in trying to achieve a multi-column unique constraint in sqlalchemy, both of which seems to have failed since a proper SQL statement is not being ...
0
votes
0answers
6 views
Add prefix_with clause to insert of a particular class
How can I customize the prefix_with of each model class in SQLAlchemy such that each one can have a different insert statement?
I actually want the OR IGNORE clause added to some of the classes.
PS: ...
1
vote
2answers
26 views
sqlalchemy OperationalError: (OperationalError) (1045, "Access denied for user
I am trying to create a remote database using mysql on an Ubuntu machine running 12.04.
It has a root user with remote login enabled.I have started the server.
output of
sudo netstat -tap | grep ...
0
votes
1answer
40 views
How do I write a query to get sqlalchemy objects from relationship?
I am learning python and using the framework pyramid with sqlalchemy as the orm. I can not figure out how relationships work. I have 2 tables, offices and users. the foreign key is on the users table ...
0
votes
0answers
27 views
Conundrum : Not Sorting Objects With SQLAlchemy
I have a feeling SQLAlchemy is only checking the first digit when it orders the groups by ID, how do I get it to check all the digits of the ID?
groups = ...
1
vote
2answers
44 views
sqlalchemy OperationalError: (OperationalError) unable to open database file None None
I am trying to create a database in a remote system.The relevant code is given below
log = core.getLogger()
engine = ...
1
vote
1answer
41 views
remote database creation in sql alchemy via sqlite
I have an sqlalchemy application that currently uses a local database.The code for the application is given below.
log = core.getLogger()
engine = create_engine('sqlite:///nwtopology.db', ...
0
votes
1answer
74 views
Sqlalchemy attribute error- Eclipse
I am trying this in my PyDev setup on eclipse:
from sqlalchemy.engine import create_engine
This gives me following error:
Traceback (most recent call last):
File ...
2
votes
1answer
22 views
SQLAlchemy aliases not aliasing?
I have the following sqlalchemy code:
x = bbc.alias().c
w = bbc.alias().c
select([func.distinct(x.region)]).where(
select([func.sum(w.population)]).where((w.region == x.region)) > 100000000
)
...
-1
votes
0answers
36 views
Python reports generator with Excel capability [closed]
i am looking for a library that would help me construct a reporting facility in python. to explain i created a program in python that interacts with a database (SQLite, for now) using SQLALchemy, and ...
0
votes
1answer
39 views
Insert new one-to-many data into tables with SQLAlchemy ORM
I'm trying to insert rows into a database that has three tables:
Artists
Songs
Media (like a youtube video)
Artists has a one-to-many relationship with Songs and Songs has one-to-many relationship ...
0
votes
1answer
20 views
update tables with computed columns in sqlalchemy
I'm working in a legacy MSSQL database using SQLalchemy, for which I have a declarative mapping.
This database has several tables that have computed columns. I can read them fine, but (of course) ...
0
votes
2answers
33 views
UnicodeEncodeError:'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)
i am a newer in python.Today when I write some search function I met an error.well, I use sqlalchemy orm to do that, in my function,I input a chinese word as the key word.The html page give me an ...
0
votes
1answer
28 views
Get attribute of object from relationship in sqlalchemy
Consider the following code defining some classes:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, Float, String, DateTime
from sqlalchemy import ...
0
votes
1answer
27 views
What is the proper way to model this type of inheritance with SQLAlchemy?
I have a pair of PostgreSQL tables that look somewhat like this (simplified example):
CREATE TABLE people (
id SERIAL PRIMARY KEY,
created timestamp with time zone DEFAULT now() NOT NULL,
...
2
votes
1answer
24 views
SQLAlchemy with single table inheritance expunge error
I'm having an issue with python SQLAlchemy single table inheritance.
Model:
class User(Base):
__tablename__ = 'user'
userID = Column(String(64), primary_key=True)
name = ...