Derived views are not persistent views. If you want to have a view
ordered on a particular column and to have that view be persistent,
you must use the view.ordered() function, i.e.
view = st.getas("test[a:i,b:s]").ordered(1)
Now all data appended to view will be ordered on the first column.
view.sort()
creates an ordered view but this has no effect on the database. If
you have done a special operation that you want to save, your best bet
is to create a new view with the same table properties,
i.e.
vw2 = st.getas("test_save[a:i,b:s"])
for row in view:
vw2.append((row.a, row.b))
You can simplify this somewhat using a special class such as
class _wrap_row:
def __init__(self, row): self._row =row
def __getattr__(self, key): reteurn getattr(self._row, key)
for row in view:
vw2.append(_wrap_row(row))
so you don't actually have to spell out row.a, row.b
If you are lucky you might be able to simply do
for row in view:
vw2.append(row)
but this doesn't work on all versions of python.
I am in the process of patching the python wrapper so you can simply
insert a view into a compatible view, but you can use this work around
until then.
Brian
_____________________________________________
Metakit mailing list - [email protected]
http://www.equi4.com/mailman/listinfo/metakit