How to sync the changes between MDS and OLTP database? - master-data-services

I am trying the SQL MDS feature.
In the explorer I have created the model, entity and attributes. Then I copied the data from the OLTP database table and pasted into excel to put (import) it into the MDS.
Question -
When I make a value change to the data in the OLTP table, then is there any way to auto update it in the MDS?
When I make a value change to the data in the MDS, then is there any way to auto update it in the OLTP table?

Related

how to update tabular data from source tables

I have a simple test setup:
A SQL Server (2017) with one database, with one table
A SQL Server Analysis Server (2017, with compatibility level 1400)
I have created a simple tabular model in Visual Studio with one datasource (the database with one table) and one table
This is my power query:
let
Source = #"SQL/MYCOMPUTER\SQLDEV;SampleDatabase",
dbo_testTable = Source{[Schema="dbo",Item="testTable"]}[Data]
in
dbo_testTable
I have deployed this tabular model to my SSAS instance...
Now my question: if the table in my SQL Server is updated (added records), how can I see these updates reflected in the Tabular Model? Do I have to rerun the Tabular Model somehow?
I have tried "Process Table" in SSMS on the Tabular model table, but it does not get the new records...
Processing a table processes whichever dimension or fact table you selected and this will only read data from the database objects used by this table. What processing is actually performed will depend on the type of processing that you used. As far as the question in the answer you posted, Process Full on an entire Tabular model will remove all data from the deployed model, then reload everything and process the hierarchies and measures as well, so yes the new data from the underlying tables will now be in the model for all tables within it after you processed it using this option. There are multiple processing types that can either be done at the database, table, or partition level. You can view additional details on these via the Microsoft reference.
I have found that on the level of the Database in the SSAS instance, there is an option "Process Database" that has an option "Process Full", which does update all the underlying tables.
But maybe there is a better way to do this?

Live sync between SQL Server 2008 R2 and MongoDB with Express

I have created custom script in Express that actually migrates SQL Server database to MongoDB.
But I am facing problems in live syncing between the two databases.
Currently I have added a column updated_by in both the databases.
Then I fetch the latest updated_by row from MongoDb and SQL Server database.
Then I check the date difference and based on it I update my MongoDB database.
There are lots of db tables and I am finding it difficult to identify that, which table is being updated.
Is there any log in SQL Server 2008 R2 that states which table is updated and at what time?
I need a mechanism like, any data update in the db table should immediately sync that rows into my MongoDB.
Any more suggestions on live data syncing is also welcome.
Thanks in advance. :)
When i have such requirement to Sync between Relational DB say (MYSQL) and Non-Relational DB (Mongodb).
I had followed following steps which may help others in future. and the concept is generally called as Change Data Capture
Capture changes (For MYSQL iam using triggers.)
Transform changes to a suitable changes
ie RDBMS to Non RDBMS
Update changes
Remember to sync the structural changes of database and corresponding implementaions.
Following links may help
https://www.flydata.com/blog/what-change-data-capture-cdc-is-and-why-its-important/

How to add new table to the database using sql workbench

I was creating MySQL database to add medicine.I created a table and I need to add one more tabe.After creating it I tried to query the database from the sql workbench.But it donot show the table but it is present in the EER Model.How can I solve this problem.
Modeling is just the task of abstractly designing your schema and its objects (e.g. tables, views etc.). It does not actually create these objects. For this you have to forward engineer your model to a server (see Database menu). Once done you can use the Synchronization feature to update either model or server (or both) with any changes made.
But keep in mind this is only for the objects, not for any data.

Data insert issue after migrating database from SQL Azure to SQL Server

I have a database on SQL Azure which has an identity primary.
After using SQL Server Import and Export Wizard, I transferred the data to my SQL Server 2008 R2 database.
My ASP.NET Application runs fine and reads the data. But When I try to insert a value in a table 'User', it gives me an error:
Cannot insert null in column 'UserId'.
The reason being that it is not able to generate the identity value.
How can I overcome this issue?
PS: I tried Generating the scripts from SQL Azure, but the SQL file is 500MB in size and my host does not allow that big a script to run.
Edit: using Entity Framework for data access. The UserId field has an IDENTITY property (1,1).
Edit Tried to create the schema from SQLAzure Migration tool and then used the import/export data to copy the data.
But the wizard does not maintain the relations amongst the rows.
The data import/export wizard doesn't preserve the whole structure of your database objects.
i.e. it will only copy the data, not the whole structure of the table that the data fits into - including identity and key definitions.
You could import the data, and then manually set all the primary keys and default fields to match your desired database definition, or you could connect to your Azure instance and use the generate script option to generate your schema in the 2008 database prior to copying.
But the real answer is that you should be using the Copy Database Wizard to accomplish this, which works fine with Azure. It was designed for this scenario.
The issue was the wizard was trying to insert primary key values, which is disabled by default. And without inserting the primary keys, the relationships can't be maintained, thus the whole issue.
To resolve this issue and do a foolproof migration, ensure that the new schema maintains all the identity columns.
When selecting the source and destination tables, for the specific tables, click on "Edit Mappings" and Check the "Enable identity insert" check box to enable insertion of primary key values, which keep the structure and relations intact.

Alter database to match model

Originally, I used Data Modelling in MySQL Workbench to design a database consisting of a series of tables (i.e. the columns and relationships).
Then using Database -> Forward Engineer, I created a database, and inserted data into the tables.
Now I've realised that the model I've designed needs some changes, and so I've altered some tables by inserted columns. My question is, how do I get MySQL Workbench to alter the tables?
Using Database -> Synchronize Model, Update Source just generates a bunch of CREATE TABLE IF NOT EXISTS sql statements, and as the tables exist, nothing changes.
What you are looking for is in the model menu Database / Synchronize model.
As I couldn't get get File -> Export -> Forward Engineer SQL ALTER Script to work, so I made a backup of the data, dropped the tables, recreated them, and then imported the data. I'd rather find a way to get MySQL Workbench to generate ALTER commands from the changes in my model
The 2011 answer is no longer up to date. I struggled to find the option in a recent version. Here is the new procedure (works for MySQLWorkbench 6.2 at least):
When you have finished editing your model, open Database -> Synchronize with Any Source
In the step Select Source you have 3 parts
Source : choose Model Schemadata
Destination : choose Live Database Server
Send updates to : choose whether the live database should be updated or if you only want to saves the changes to a .sql file
Proceed in the wizard, you can then review the tables and sql queries that will be executed. You can also ignore the update of some tables.