Ordered views are acting strangely. I'm using python with the latest metakit.

view is as follows, two string columns A,B

vw = st.getas("test[a:S,b:S]").ordered(1)

vw.append(("JC4929", "a"))
vw.append(("JC4929", "b"))

yields (as expected) ->

a       b
------  -
JC4929  a
JC4929  b
------  -
Total: 2 rows

vw.append(("JC4929", "1"))

obliterates the first row ->
a       b
------  -
JC4929  1
JC4929  b
------  -
Total: 2 rows

What's worse is that it is order dependent:
vw.append(("JC4929", "a")) and 'b' is obliterated.

a       b
------  -
JC4929  1
JC4929  a
------  -
Total: 2 rows

Which just tells me that I don't know how the ordered column is supposed to work. It appears to except multiple key entries for the same orderd column and then checks the other columns for uniqueness, for example this would not add a row: vw.append(("JC4929", "a")) to the above column.

One really bad case is:

vw.append(("JC4929", '24227N'))
vw.append(("JC4929", '498N'))

a b ------ ------
JC4929 24227N
JC4929 498N ------ ------
Total: 2 rows


and now enter in the reverse order

vw.append(("JC4929", '498N'))
vw.append(("JC4929", '24227N'))

a b ------ ------
JC4929 24227N
------ ------
Total: 1 rows


attached is the sample code

import metakit

print "ordered columns with alphabetical strings"
st = metakit.storage()
vw = st.getas("test[a:B,b:B]").ordered(1)

# two entries
vw.append(("JC4929", "a"))
vw.append(("JC4929", "b"))

metakit.dump(vw)

print "now add a string with a number at the front"
print "this is not the same behavior :)"
vw.append(("JC4929", "1"))
metakit.dump(vw)
vw.append(("JC4929", "a"))
vw.append(("JC4929", "a"))
metakit.dump(vw)

print
print "ordering is insertion order dependent"
print "two pieces of data are added in different orders"
st = metakit.storage()
vw = st.getas("test[a,b]").ordered(1)

print
print "order 1, '22427N', '498N'"
vw.append(("JC4929", '24227N'))
vw.append(("JC4929", '498N'))
metakit.dump(vw)

st = metakit.storage()
vw = st.getas("test[a,b]").ordered(1)

print
print "order 2 '498N', '22427N'"
vw.append(("JC4929", '498N'))
vw.append(("JC4929", '24227N'))
metakit.dump(vw)








_____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit

Reply via email to