Closed GoogleCodeExporter closed 9 years ago
I give a sample logic on Dimension.ensure logic:
58 ¦ for row in role_results:
59 ¦ ¦ try:
~ 60 ¦ ¦ ¦ res = role_dim.lookup(row, {
61 ¦ ¦ ¦ ¦ 'name': 'Name', 'is_disabled': 'Disabled'}
~ 62 ¦ ¦ ¦ ¦ )
+ 63 ¦ ¦ ¦ if res is not None:
+ 64 ¦ ¦ ¦ ¦ new_row = self._role_row_format(row)
+ 65 ¦ ¦ ¦ ¦ print new_row
+ 66 ¦ ¦ ¦ ¦ role_dim.update(new_row)
+ 67 ¦ ¦ ¦ else:
+ 68 ¦ ¦ ¦ ¦ role_dim.insert(row, {
+ 69 ¦ ¦ ¦ ¦ ¦ 'name': 'Name', 'is_disabled': 'Disabled'}
+ 70 ¦ ¦ ¦ ¦ ¦ )
71 ¦ ¦ except MySQLdb.IntegrityError:
72 ¦ ¦ ¦ raise CommandError('get error by insert row data "%s" ' % row)
73 ¦ connection.commit()
i just apply a update case on ensure. could you give a suggestion.
Original comment by xia...@gmail.com
on 2 Apr 2014 at 11:47
The current SlowlyChangingDimension class supports type-2 changes or type-1 and
type-2 changes together. It is correct that the class does not support type-1
changes alone (i.e., without type-2 support enabled).
We expect to add a class for type-1 changes alone. In the meantime, the best
option would probably be to use update(...) as in your example.
Original comment by c...@cs.aau.dk
on 3 Apr 2014 at 7:40
The new TypeOneSlowlyChangingDimension class solves this.
Original comment by c...@cs.aau.dk
on 7 Apr 2015 at 9:02
Original issue reported on code.google.com by
xia...@gmail.com
on 2 Apr 2014 at 9:16