django database can not get the updated data - django-models

our client updates the database. Then the mysql database updated, server should read the updated value from database at that moment. But its not happening. To read the updated value from the database, I have to restart the server. Then I see the updated values.

You don't need to restart the database if you update it. Maybe your update misses the final COMMIT?
If you use SQL with connection.execute() you need to call commit_unless_managed() at the end.

Related

Verify Database not updating all tables

We are getting ready to release a new version of our database and I am trying to update our standard documents in Crystal Reports 2013 via Database > Verify Database. I am getting messages about some of the tables in the document being updated, but not all of the ones with updated schema. I know that I am connecting to the correct database, because if I try to add a new instance of the same table, it will have the correct fields. Is there a way to force a particular table to update?
We figured out the the table that was not updated was being pulled from a different SQL view -- when that view was updated to the new schema, Verify Database could be rerun and it found and updated all of the tables

Tracking SQL Server tables using Change Tracking; but how can I be notified of when a table is modified?

I need to migrate data from SQL Server to an external warehouse (PostgresSQL) continuously (pretty much a read replica).
For this, I am using SQL Server's Change Tracking.
After change tracking is configured for a table, any DML statement that affects rows in the table will cause change tracking information for each modified row to be recorded. To query for the rows that have changed and to obtain information about the changes, you can use change tracking functions.
My question is: how can I make SQL Server alert me that there is a change, so my application can query for the changes?
Is there any way I can create a trigger for that and make it publish an event?
Thanks.

migrating database back to original database entity framework migrations

I have made some changes to a database using code first entity framework migrations (lets say db2).
I now want to revert the change made back to the original database. As we want to retain the data on the old database (db1) I cant simple clone it.
Can someone please confirm the right process to do this?
I am assuming I will need to perform a rollback on db2 back to the original state it was in when it was cloned from db1.
I would then switch context so I am pointing at db1.
I then add a migration to generate all the database changes.
I then perform update-database to run make the changes.
Is this correct?
I will then need to run a migration to br
You can use –TargetMigration parameter in order to migrate to a specific version:
Update-Database –TargetMigration: db1
More info.

timestamp column doesn't update in sql server

I moved an Access database backend to sql server and am still using an Access frontend. I am now getting overwrite errors when entering records. I found a solution (thank you) to add a Timestamp (rowversion) column to the table which I did. However, the timestamp column does not populate for new records nor did it update on the existing records. Your help is much appreciated.
The Timestamp field is for SQL Server's use only. Access neither reads or writes it, but the ODBC driver does.
Its sole purpose is for the ODBC driver to see, before updating a record, if this has changed on the server since the last reading by the driver. If it hasn't, the update is safe - if it has, the record is re-read and the update cancelled.

Recover and Roll back SQL DB State

Friends,
I'm looking for an solution on SQL DB server. I'm being working in support organization on managing SQL Server.
When we make some changes on SQL DB (Schema changes, table alteration, data etc..) and found it is not compatible we need to roll back easily.
Something like, before i make any changes on my DB server need to preserve current state of DB and once changes were made and if looks good then i can commit permanantly. If not working properly i can discard the changes and revert to previous state quickly.
Is there any such option available?
You can create Database Snapshot which helps to prevent administrative error.
Here is a link that can help you understand how to create and apply database snapshot:
Database Snapshot

Resources