Forums

Disappearance of data from one of my database tables

hi, the main issue is that data from one of my database tables mysteriously disappears. This has been happening for at least a few weeks. Sometimes, it is there at night but when I log in the morning, it has disappeared. Sometimes it disappears in the middle of my working day. Has anyone ever reported this issue? It's only from ONE table.

I thought I would add database triggers to track what is happening to that table. But I don't have the correct privileges to do that. I get the below error when I tried to add triggers ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust _function_creators variable)

When I try to do something similar to GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' WITH GRANT OPTION; I get the error ERROR 1044 (42000): Access denied for user 'ccc'@'%' to database 'vvv'

Any suggestions would be much appreciated. Thanks a lot!

Unfortunately we can't give you the SUPER privilege, since it would let you kill processes belonging to other users. But perhaps we could set up the trigger for you, if you let us know exactly what the command was you were trying to run?

That will be great.

Do you need details of my username and password? Do you have an email id where I can send that information?

Below are the triggers I would like you to create for me

CREATE TRIGGER costtool_prices_ai AFTER INSERT ON costtool_prices FOR EACH ROW INSERT INTO costtool_history SELECT 'insert', NULL, NOW(), d.* FROM costtool_prices AS d WHERE d.id = NEW.id;

CREATE TRIGGER costtool_prices_au AFTER UPDATE ON costtool_prices FOR EACH ROW INSERT INTO costtool_history SELECT 'update', NULL, NOW(), d.* FROM costtool_prices AS d WHERE d.id = NEW.id;

CREATE TRIGGER costtool_prices_bd BEFORE DELETE ON costtool_prices FOR EACH ROW INSERT INTO costtool_history SELECT 'delete', NULL, NOW(), d.* FROM costtool_prices AS d WHERE d.id = OLD.id;

Thanks!

Having looked into it, it looks like we're not going to be able to add those triggers for you... Can you think of another way of debugging?

I know the exact line that causes the problem but don't know why that is being called - it should be run only when a button is pressed.

m.Prices.objects.filter(priceProvider='User').delete()

If the view that has that code in it is a GET url with no login requirement, it's probably being hit by a spider for a search engine.

Very interesting. Thank you!

My users want to know if anybody (could be a spider or a human :-)) could have copied code from the website. Is there any way of telling that?

There isn't, but there's also no way built into PythonAnywhere that would expose your code. However, there are things that you could do (like pointing a static files entry at your code) that could expose your code.

Please give me an example of static files entry. Thanks!

You can find your static files entries on the "web" tab...

Thanks - so if I have an entry ../../../costtool/costtool/static in static files, can people access only the code in static folder or would be able to get all the code in costtool/costtool too? thanks!

Only the static folder.

Thanks - all of you are very helpful.

:-)