I am building a small WSGI application and I am having an intermittent problem with SQLAlchemy throwing an UnboundExceptionError.
When it happens, it seems to happen exclusively on the second request the browser makes. Refreshing the page (and all following page view attempts) run fine. It seems to only happen on the second request.
I ...
Hello there,
i want to know if sqlalchemy has some problems querying a view? Because if i query the view with normal sql on the server like:
select * from ViewMyTable where index1 = '608_56_56';
i get a hole butch of entries.
But with SQLAlchemy i get only the first one. But in the count is the correct number. I have no idea why...
Hi. I have the following exception when using sqlalchemy on postgres:
raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect)
ProgrammingError: (ProgrammingError)
can't adapt 'UPDATE doc_data SET
content=%(content)s WHERE
doc_data.serial_id =
%(doc_data_serial_id)s' {'content':
'Progr...
I'm looking for a SQLAlchemy only solution for converting a dict received from a form submission into a series of rows in the database, one for each field submitted. This is to handle preferences and settings that vary widely across applications. But, it's very likely applicable to creating pivot table like functionality. I've seen th...
I want to add a field to an existing mapped class, how would I update the sql table automatically. Does sqlalchemy provide a method to update the database with a new column, if a field is added to the class.
...
So I have a huge list of entries in a DB (MySql)
I'm using Python and Django in the creation of my web application.
This is the base Django model I'm using:
class DJ(models.Model):
alias = models.CharField(max_length=255)
#other fields...
In my DB I have now duplicates
eg. Above & Beyond, Above and Beyond, Above Beyond, ...
How do I group query results by the hour part of a datetime column in SQLAlchemy?
...
hi i have a many to many relationship between a user and a group.and i will like to add a user with many groups in my database.how do i do that if my database is as follows
user_group_table = Table('tg_user_group', metadata,
Column('user_id', Integer, ForeignKey('tg_user.user_id',
onupdate="CASCADE", ondelete="CASCADE")),
...
I'm new to sqlalchemy, and while the documentation seems fairly thorough, I couldn't find a way to do quite what I want.
Say I have two tables: forum and post. Each forum has a parent forum, and any number of posts. What I want is:
A list of top-level forums
Eagerly loaded child forums accessible through the top-level forums
A count o...
Currently an application of mine is using SQLAlchemy, but I have been considering the possibility of using Django model API.
Django 1.1.1 is about 3.6 megabytes in size, whereas SQLAlchemy is about 400 kilobytes (as reported by PyPM - which is essentially the size of the files installed by python setup.py install).
I would like to use...
Hello everyone!
Could anyone explain the difference between filter and filter_by functions in SQLAlchemy? I am confused and can't really see the difference. Which one should I be using?
Thanks,
Boda Cydo
...
Hi all
I am giving Pylons a try with SQLAlchemy, and I love it, there is just one thing, is it possible to print out the raw SQL CREATE TABLE data generated from Table().create() before it's executed?
...
I have another quick question about SQLAlchemy.
If I have added a query_property [1] field in my SQLAlchemy Table class, is it possible to narrow down the SELECTed fields?
Here is what I mean.
Suppose my class Comments has this:
class Comments:
query = Session.query_property()
...
Then if I do the following:
>>> print Ses...
I have a Plone product that uses collective.lead to configure SQLAlchemy, including an in-Plone database configuration interface as documented in Professional Plone Development. How should I port this to z3c.saconfig? Will I be able to keep the in-ZODB configuration or will it need to go into site.zcml?
...
Hello everyone,
How do you handle errors in SQLAlchemy? I am relatively new to SQLAlchemy and do not know yet.
Before I used SQLAlchemy, I would do things like
status = db.query("INSERT INTO users ...")
if (!status):
raise Error, db.error
But now I am coding in SQLAlchemy and I do things like
user = User('Boda Cydo')
session.ad...
I have the following code runs over a large set of data (2M). It eats up all my 4G mem before finishing.
for sample in session.query(CodeSample).yield_per(100):
for proj in projects:
if sample.filename.startswith(proj.abs_source):
sample.filename = "some other path"
...
I am trying to create a table to hold user actions on my web app. Take a simple case where a user adds a new story, and comments on it. This will add two entries to the user_action table. In the user_action table I would like to store the module name associated with each action and the items id. In this cause I would store the modules as...
So I'm brand new to SQLAlchemy, and I'm trying to use the SQL Expression API to create a SELECT statement that specifies the exact columns to return. I found both a class and a function defined in the sqlalchmey.sql.expressions module and I'm not too sure which to use... Why do they have both a class and a function? When would you use on...
Suppose I have the following tables:
Articles with fields article_id, title
Tags with fields tag_id, name
ArticleTags with fields article_id, tag_id
And I wish to find all articles that have a given tag. How do I create this complicated join in SQLAlchemy?
In SQL it would look like:
SELECT a.article_id, a.title FROM Articles AS a
J...
In a little script I'm writing using SQLAlchemy and Elixir, I need to get all the distinct values for a particular column. In ordinary SQL it'd be a simple matter of
SELECT DISTINCT `column` FROM `table`;
and I know I could just run that query "manually," but I'd rather stick to the SQLAlchemy declarative syntax (and/or Elixir) if I c...