Tagged Questions

1
vote
1answer
26 views

How to return Sqlalchemy result as JSON?

The Sqlalchemy result can have 0 to many records. Result is: record = meta.Session.query(model.EmpsTable).filter(model.EmpsTable .firstname.like(searchQuery)) If there was only one record ...
0
votes
0answers
10 views

SQLAlchemy Decomposing DateTime Fields

I have a model of the form: class MyModel(base): # ... datetime = Column(DateTime) # ... and would like to create a .date and a .time property which correspond to the .datetime column. ...
0
votes
0answers
14 views

SQLAlchemy relationships between three tables

I have three tables: Devices, Slots, Ports. Devices will have several Slots Slots will have several Ports, but belong to a single Device Ports belong to a single Slot In my experience, this shows ...
1
vote
1answer
18 views

Many-to-many multi-database join with Flask-SQLAlchemy

I'm trying to make this many-to-many join work with Flask-SQLAlchemy and two MySQL databases, and it's very close except it's using the wrong database for the join table. Here's the basics... I've ...
0
votes
2answers
25 views

sqlalchemy, read from mysql and write to memory

I have a program communicating with a mysql database, which I should avoid to modify it until everything works fine. So I already have a way to create a fake in-memory database (using ...
0
votes
0answers
16 views

Index not working with postgresql and sqlalchemy

I have a table in postgresql that I am accessing through sqlalchemy. When I imported the data, I imported the indexes to a field like this: db.Column(db.Integer, primary_key=True) When I try to add ...
0
votes
1answer
19 views

SELECT UNCOMPRESS(text) FROM with sqlalchemy

I store the MySQL Compress function to insert compressed blob data to the database. In a previous question I was instructed to to use func.compress ( mysql Compress() with sqlalchemy ) The ...
3
votes
2answers
56 views

RIGHT OUTER JOIN in SQLAlchemy

I have two tables beard and moustache defined below: +--------+---------+------------+-------------+ | person | beardID | beardStyle | beardLength | +--------+---------+------------+-------------+ ...
0
votes
2answers
29 views

SQLAlchemy modelling a complex relationship using reflection

I am querying a proprietary database which is maintained by a third party. The database has many tables each with large numbers of fields. My problem refers to three tables of interest, Tree, Site ...
1
vote
2answers
21 views

SQLAlchemy inheritance with relationship is None in instantiated object

I would like to have a 'relationship' in an inherited (mixin) class. However, when I create the inherited object, the relationship object is None. I cannot append to it. How do I resolve this? Here ...
1
vote
2answers
51 views

Does the number of columns affect the speed of sqlalchemy?

I created two tables with sqlalchemy (python 2.7), the database is mysql 5.5. The following is my code: engine = create_engine('mysql://root:123@localhost/test') metadata = MetaData() conn = ...
-2
votes
0answers
35 views

Python. Filter for custom data source

SQLAlchemy is very good. But It's for databases. I need something like SQLAlchemy's filter for custom data source. Java have QueryDSL. You can create modules, e.g. for mongodb, or implementation for ...
1
vote
1answer
37 views

SQLAlchemy: Warning when using sqlalchemy, saying that scoped session already present [closed]

When I try to run my web server with SqlAlchemy, I keep getting this warning saying that a scoped session is already created: SAWarning: At least one scoped session is already present. configure() ...
0
votes
2answers
23 views

sqlalchemy engine multiple databases with mysql

I tried a few different things but I could not succeed, so maybe it's just not possible. When I create a sqlalchemy engine with create_engine('mysql://user@host/database') it looks like the ...
0
votes
2answers
33 views

SQLAlchemy import errors in Pydev/Eclipse

I tried installing SQLAlchemy for Python 3.2 which I use with Eclipse/Pydev. A simple test script fails from sqlalchemy.engine import create_engine ...
0
votes
1answer
35 views

ORM query with or statement

I am trying to query users by list of id using in statement http://www.w3schools.com/sql/sql_in.asp It is possible to do it without string query and execute function? I am looking for something like ...
0
votes
1answer
31 views

Sqlalchemy class is not iterable / converting relationship to a set

I'm trying to convert a one-to-many part of a many-to-many relationship to a python set(). See the following play example for code: message_tos = Table('message_tos', Base.metadata, ...
0
votes
1answer
38 views

Django - (OperationalError) FATAL: Ident authentication failed for user “username”

I've written a simple sqlalchemy-django model, according to this manual: http://lethain.com/replacing-django-s-orm-with-sqlalchemy/, which worked for me pretty well. My Django is connected to a remote ...
1
vote
2answers
63 views

SqlAlchemy - When should new session creation occur?

Being new to SQLAlchemy, I was wondering at what time would Session() should be called, in say, a view. Should it be defined as a global variable, or should a new session be created for each ...
2
votes
2answers
45 views

How to query those Objects that are not joined (SQLAlchemy)

I have two models in SQLAlchemy, having a many-to-many relationship team_user_table = Table('team_user', Base.metadata, Column('user_id', Integer, ForeignKey('users.id')), Column('team_id', ...
3
votes
3answers
51 views

Trying to catch integrity error with sqlaclhemey

I'm having problems with trying to catch a error. I'm using pyramid/sqlalchemy and made a sign up form with email as the primary key. The problem is when a duplicate email is entered it raises a ...
0
votes
1answer
29 views

How to find the offending attribute with a sqlalchemy IntegrityError

I have a very simple SqlAlchemy model class User(Base): """ The SQLAlchemy declarative model class for a User object. """ __tablename__ = 'users' id = Column(Integer, primary_key=True) ...
0
votes
1answer
30 views

How to use database in app_globals.py in turbogears2?

Possibly related topic, but from which I could not solve the problem: How to initialize global variables in TurboGears 2 with values from a table The issue is that I'm trying to read some config ...
0
votes
1answer
53 views

How to manage user-specific database connections in a Pyramid Web Application?

We are using Python Pyramid with SQLAlchemy and MySQL to build a web application. We would like to have user-specific database connections, so every web application user has their own database ...
3
votes
1answer
49 views

SQLAlchemy - Searching Three Tables at Once

EDIT: Please excuse me, as I have just realised I've made an error with the example below. Here's what I want to achieve: Say I have the three tables as described below. When a user enters a query, ...
0
votes
1answer
36 views

SQLAlchemy group by a minute (from mysql-query to sqlalchemy)

The task is a grouping of datetime values into per minute points. I have a custom SQL-query: SELECT COUNT(*) AS point_value, MAX(time) as time FROM `Downloads` LEFT JOIN Mirror ON ...
0
votes
1answer
34 views

Request a simple alembic working example for Auto Generating Migrations

I installed alembic 0.3.4, sqlalchemy, SQLite version 3.7.4, and upgraded SQLAlchemy 0.6.4 to SQLAlchemy 0.7 or greater from my ubuntu. I followed the instruction: ...
2
votes
3answers
62 views

removing error query during commit

I have postgresql db which i am updating with around 100000 records. I use session.merge() to insert/update each record and i do a commit after every 1000 records. i=0 for record in records: ...
0
votes
1answer
47 views

SQLAlchemy menu items hierarchy/ordering

I am pretty new to ORM so I need some help with creating menu for my Flask app. I have implemented model MenuItem (src is below). Bullet-points are: It has one-to-many relationship with itself. It ...
1
vote
1answer
54 views

How to put fom validation in the model using SQLAlchemy?

I see lots of apps using Form objects to validate data and then passing the data to the model, while putting absolutely no validation in the model. I feel it's better to put core validation in the ...

1 2 3 4 5 46
15 30 50 per page