[sqlalchemy] Re: Simple join

2009-10-07 Thread Mike Conley
> Now I want to build a query to get all Workstations which are related > to server 'foo'. > > This works: > > ws = DBSession.query(WorkStation).select_from(join(WorkStation, > DHCPServer)).filter(DHCPServer.label == 'foo').all() > > but It's too complex. Is there an easier way? > > Something like:

[sqlalchemy] Re: Very odd utf8 problem

2009-10-07 Thread Yo'av Moshe
Thanks, I didn't know about that awful IPython bug... I checked, and apparently my website is already doing the SA query with a unicode object and not with a string one, so I think that it's not the u'' thing (it's true that I forgot it in my console testing, though). What you showed about IPython

[sqlalchemy] Re: Portable Enum Columns

2009-10-07 Thread Yannick Gingras
On October 7, 2009, Michael Bayer wrote: > the ticket is here: > > http://www.sqlalchemy.org/trac/ticket/1109 > > you'll see from the discussion the issue is not nearly so straightforward. Right, looks like I should either go with PGEnum or stick to varchar FKs if I need something that is portab

[sqlalchemy] Re: Very odd utf8 problem

2009-10-07 Thread Wolodja Wentland
On Wed, Oct 07, 2009 at 07:55 -0700, Yo'av Moshe wrote: > See what I mean here (it's me running the same query twice in > IPython): http://paste2.org/p/457059 > > What can cause this behavior?! I can't think of anything! I guess that > one of my users has uploaded some article with some invalid ut

[sqlalchemy] postgresql "CREATE SCHEMA" statement does not create schema

2009-10-07 Thread Faheem Mitha
Hi, When running this function with postgresql 8.4 and sqla 0.5.5, def test(dbstring): from sqlalchemy import create_engine db = create_engine(dbstring) conn = db.connect() from sqlalchemy.sql import text gq = text(""" SET search_path TO public; DROP SCHEMA IF EXISTS

[sqlalchemy] Simple join

2009-10-07 Thread Diego Woitasen
Hi, I have this simple model: class DHCPServer(DeclarativeBase): __tablename__ = 'dhcp_server' id = Column(Integer, primary_key = True) hostname = Column(Unicode(80), nullable = False) ip = Column(Unicode(16), nullable = False) label = Column(Unicode(80)) class WorkStation(D

[sqlalchemy] Difference between result_processor and process_result_value?

2009-10-07 Thread phrrn...@googlemail.com
I had some (working) code with a typeadaptor that used the process_result_value style. I changed this to use the result_processor style and returned a calleable and some tests started to fail. It seems that with the process_result_value form, value is a datetime object. When using result_processo

[sqlalchemy] Re: Very odd utf8 problem

2009-10-07 Thread Yo'av Moshe
Um, why? It's true that it doesn't fail when I add that 'u', but it returns nothing (an empty list). What's that REPL? Yo'av 2009/10/7 Michael Bayer > > Yo'av Moshe wrote: > > > > Hey! > > I'm using SA in a TurboGears website for quite a long time now, and it > > was working great for a long t

[sqlalchemy] Re: How to get SA column object from table.col, declarative attribute, or elixir entity attribute

2009-10-07 Thread Michael Bayer
Randy Syring wrote: > > Can anyone give me an idea of what I need to do here? If I can just > get a high level overview of what I need to do, I am happy to read the > documentation and source to fill in the details. column: column.type declarative attribute: MyClass.some_attribute.prop

[sqlalchemy] Re: Very odd utf8 problem

2009-10-07 Thread Michael Bayer
Yo'av Moshe wrote: > > Hey! > I'm using SA in a TurboGears website for quite a long time now, and it > was working great for a long time, until now! In my website users can > upload articles, edit them, etc... The problem is with the search > function - for some reason, searching for a certain wor

[sqlalchemy] Re: How to get SA column object from table.col, declarative attribute, or elixir entity attribute

2009-10-07 Thread Randy Syring
Can anyone give me an idea of what I need to do here? If I can just get a high level overview of what I need to do, I am happy to read the documentation and source to fill in the details. Thanks. On Oct 1, 1:56 pm, Randy Syring wrote: > Mike, > > Thank you for the prompt reply: > > On Oct 1, 1

[sqlalchemy] Very odd utf8 problem

2009-10-07 Thread Yo'av Moshe
Hey! I'm using SA in a TurboGears website for quite a long time now, and it was working great for a long time, until now! In my website users can upload articles, edit them, etc... The problem is with the search function - for some reason, searching for a certain word in my language (Hebrew) kills

[sqlalchemy] Re: Flushing all sessions

2009-10-07 Thread Алексей Ужва
>Do you really want to flush session in other threads not knowing in which state they are? Uhm, that's a good point... I just want to flush created objects wich created in my function,but belongs to other session because references to objects in other session. For example: def my_function(foo_ob

[sqlalchemy] Re: Portable Enum Columns

2009-10-07 Thread Michael Bayer
Yannick Gingras wrote: > On October 6, 2009, Adrian von Bidder wrote: >> On Tuesday 06 October 2009 14.45:33 Yannick Gingras wrote: >> [...] >> > Is there another way to do it? Something that would be portable and >> > to both MySQL and Postgres would be great. >> >> Since both pg and mysql hav

[sqlalchemy] Re: Flushing all sessions

2009-10-07 Thread Tomasz Jezierski - Tefnet
Dnia 2009-10-07, Śr o godzinie 04:30 -0700, Alexey pisze: > Hello. > > I'm using SQL Alchemy as a persistence engine for my multi-threaded > desktop application with sqlite backend. > > ScopedSession acts very well, but there is a problem: > > 1) I have 2 tables: > > categories_table = Table(

[sqlalchemy] Flushing all sessions

2009-10-07 Thread Alexey
Hello. I'm using SQL Alchemy as a persistence engine for my multi-threaded desktop application with sqlite backend. ScopedSession acts very well, but there is a problem: 1) I have 2 tables: categories_table = Table('category', metadata, Column('id', Integer, primary_key=True), Column(

[sqlalchemy] Re: Portable Enum Columns

2009-10-07 Thread Yannick Gingras
On October 6, 2009, Adrian von Bidder wrote: > On Tuesday 06 October 2009 14.45:33 Yannick Gingras wrote: > [...] > > Is there another way to do it? Something that would be portable and > > to both MySQL and Postgres would be great. > > Since both pg and mysql hava a native enum type, it's only