TheGU / fin-ally

Automatically exported from code.google.com/p/fin-ally
GNU General Public License v3.0
0 stars 0 forks source link

Elixir overwriting entered data? #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
session.commit() seems to work once per launch of the FA tool. That is, if some 
data is pushed into an object and then commit() is called, the data will be 
displayed in the grid. Presumably this means that the data has actually made it 
into the database - but this may not be accurate. If new data is pushed into 
the objects and they are committed - the old data seems to be replaced. Closing 
and re-opening the tool reveals that only the latest set of data is present.

Elixir creates a default session for you to use - but you can override that by 
creating a "regular" session just like SQLAlchemy. This can be seen here:

http://elixir.ematia.de/trac/browser/elixir/trunk/tests/test_options.py

One idea is to try and create a session, explicitly add some objects to it, 
commit the session, and then close the session. This would take some of the 
control out of Elixir's hands.

Original issue reported on code.google.com by Daniel.S...@gmail.com on 12 Aug 2010 at 1:29

Attachments:

GoogleCodeExporter commented 9 years ago
after reviewing some of the test cases shown here:

http://elixir.ematia.de/trac/browser/elixir/trunk/tests/test_options.py

I think FINally might be misusing the session object, or using it in an overly 
simplified way. Review these scripts and experiment with other more direct 
implementations of the session object. Note that in several cases Elixir allows 
direct or nearly direct SQLAlchemy calls.

Original comment by Daniel.S...@gmail.com on 13 Aug 2010 at 2:14

GoogleCodeExporter commented 9 years ago
ok, the solution to this problem ended up being that I need to use new Elixir 
objects User, Expensetype, and Expense) for each new expense I create. Re-using 
objects will result in edits, not new database entries. This can be observed by 
looking at the 'id' column of the SQL commands Elixir generates.

The fix for this was basically to avoid using a global set of User, 
ExpenseType, and Expense objects for data entry. Create a new object for each 
entry requested.

Original comment by Daniel.S...@gmail.com on 14 Aug 2010 at 12:40

GoogleCodeExporter commented 9 years ago

Original comment by Daniel.S...@gmail.com on 14 Aug 2010 at 12:40