generative .column() method don't work corretcly (columns will be added to cloned selects)

Issue #752 resolved
Former user created an issue

I found that using column() method on Select object, don't correctly creating new select statement - orginal statement and newly created statement have the same _raw_columns list. Then adding column to any select (new or orginal) gives this column to both statements. I think this is not how generative functions should work.

### --- PREPARATION
>>> from sqlalchemy import Table,Column,String,MetaData
>>> table = Table('foo',MetaData(),Column('bar',String))
>>> select = table.select()

### --- TESTs
>>> print select 
SELECT foo.bar 
FROM foo # ok
>>> select_copy = select.column('yyy')
>>> print select_copy
SELECT foo.bar, yyy 
FROM foo # ok
>>> print select
SELECT foo.bar, yyy 
FROM foo # VERY VERY BAD !

### --- CAUSE:
>>> select.columns is select_copy.columns 
False # ok
>>> select._columns is select_copy._columns
False #ok 
>>> select._raw_columns is select_copy._raw_columns
True # that is the problem i think

Comments (2)

  1. Log in to comment