How to transfer data from Tabular model (SSAS Tabular) to Relational Database? - ssas

I am new to SSAS and Tabular model cubes. I have a data migration task that aims to import data from a Tabular model into a SQL Server database.
I have tried SSIS with not success. Using OLEDB Data source connected SSAS instance with Tabular database, I configured the data source to execute and MDX command " evaluate ('Tabular Table Name') ". It returns successfully but only partial number of records (around 1000) are returned. So i reconfigured the data source to use OPENROWSET and selected the tabular table that i want to query but I am always getting an error related to Column mapping, even though the column mapping is correct.

Okay, I suggest you try this way (I tried it with our PowerPivot databases, which is pretty similar to SSAS Tabular_:
Run SSMS and connect to SSAS Tabular instance
Right-click the database you want to dump into SQL Table and select Script -> Create to -> New Query Window. Be patient and wait until SSMS generates XMLA script for you
Find SQL queries that were used to fill SSAS tabular tables by searching XMLA script (keyword = QueryDefinition)
This is what I got for our database:
<Partitions>
<Partition>
<ID>factLinksSeller_484c3291-2123-4391-8627-fd4b584d1726</ID>
<Name>factLinksSeller</Name>
<Annotations>
<Annotation>
<Name>IsQueryEditorUsed</Name>
<Value>True</Value>
</Annotation>
<Annotation>
<Name>QueryEditorSerialization</Name>
</Annotation>
<Annotation>
<Name>TableWidgetSerialization</Name>
</Annotation>
</Annotations>
<Source xsi:type="QueryBinding">
<DataSourceID>15719e99-95fb-44c1-8399-18a769ae1be4</DataSourceID>
<QueryDefinition>select
*
from
dbo.factLinksFull X
where X.signaturePersonID=16
</QueryDefinition>
Now you can use this queries to load data into your SQL Server DB via SSIS
Even if you filled Excel files by external tool, after importing them to SSAS this data should be stored somewhere, so you could check it in XMLA script and make the decision what to do next
There exists a much more simple way to do it, if you have local PowerPivot workbooks and your memory can handle datasets from those:
Open your PP workbook, run PowerPivot
Switch to Data View
Copy whole table from the tab you are on, by pressing icon in the left upper corner of it, then press CTRL+C and wait for the data to be transferred to the memory
Paste your data in another Excel 2013 file, since they now can handle almost any size of data, or MS Access table. Then import data to SQL Server

Related

Automation to pull data into excel from SQL

I have a report that I generate on a weekly basis. I have the code written in SQL and I then pull all the data into excel's data model.
I then create pivot tables and dashboards in excel from that particular data.
The SQL code creates new table of the same name everytime and deletes the older version of the table. There isn't any way for me to just append the new data as the report is run from the very start and not just on the new data.
I wish to automate this process of refreshing my dashboard from the data I produce in SQL. Is there a way to do so?
Currently I create a new table in SQL, import data into the excel's data model and then recreate the dashboard.
I am not even sure if this is possible. Any help would be greatly appreciated!
Solved!
After some digging, I was able to find a feature that Excel's data model supports.
Instead of making a connection directly to a SQL Server Table, you can create a connection by writing a SQL Query.
This way, even if you delete the table for updating it, as far as the name remains the same, Excel's data model would be able to pull data from the table just by you hitting refresh!

Move data between two Azure SQL databases without using elastic query

I am in need of suggestion to move data from a particular table in one azure sql database to the other azure sql database which has the same table structure without using elastic query
Using SQL Server Management Studio to connect to SQL azure database, right click the source database and select generate scripts.
During the wizard, after have select the tables that you want to output to a query window, then click advanced. About half way down the properties window there is an option for "type of data to script". Select that and change it to "data only", then finish the wizard.
The heck the script, rearrange the inserts for constraints, and change the using at the top to run it against my target DB.
Then right click on the target database and select new query, copy the script into it, and run it.
This will migrate the data.
Please consider using the "Transfer SQL Server Objects task" in SSIS. You can learn all the advantages it provides on this article.
You can use PowerShell to query each database and move data between them as needed. Here's an example article on how to get this done.
Using PowerShell when working with Azure has a number of other benefits in what you can do and can control as well. It's a good choice to spend time learning.
In the source database I created SPs to select the data from the tables.
In the target database I created table types (which would be available in programmability) for the tables with the same structure as in the source.
I used Azure function to move the data into table type from source.
In the target database I created SPs to insert data into the tables from their respective table types.
After ensuring the transfer of data, I would be deleting those records moved to the target in the source database and for this I created SPs.

New mondrian cube not available in XMLA pentaho

I have a mondrian cub xml schema file. I have used it a a basis for an Analysis DataSource. I can query the thing file with Saiku, and everthing works fine.
However, when I use olap4j and try to connect to it via the xmla connetor, it does not show up in the list of cubes. Other cubes show up and can be queried. I set the EnableXmla parameter to true.
Code:
NamedList<Catalog> c = oConnection.getOlapCatalogs();
NamedList<Schema> l = oConnection.getOlapSchemas();
Schema schema = oConnection.getOlapSchema("myCube");
NamedList<Cube> cubes = schema.getCubes();
When I print out the list of Catalogs, I can see it, but only one Schema and only one Cube are listed when I print them out. (Not the one I want of course)
I have refreshed and rebooted the server. Is there anything else I need to do?

SSRS Report Data Source for Query with Multiple Databases

I have a dataset that pulls from multiple databases on the same server. Historically (without doing research) in this case I would set the data source to ReportServer (the database that houses the execution log for the server, ect.) and noticed the dataset doesn't seem to care what the data source is.
I did a few hours of digging and couldn't find an answer. When using (or in my case, unioning) multiple data bases in a dataset, what should the dataset data source be in Visual Studio?
Specifying the database in the connection string sets the starting, default database for the query. If your permissions are adequate, then there is nothing to stop you from accessing other databases.
The database in the connection string will give your query the context that is used when you don't specify a database name as part of a table. If your query is simply:
SELECT * FROM vw_Interactions
then this will run against the database specified in your connection string.
For your case, when using a table with the same name across multiple databases, the default database doesn't matter much, as long as the data access account has permissions that let the query work.

How can I carry a database created in dbDesigner to SQL Server

I created a small database in dbDesigner which includes 4 tables, and I want to add these tables with their relationships to a database on a SQL Server. How can I do this?
Best practice for this that I am aware of, is using Management Studio's functionality for this.
The following steps will produce a file containing an SQL script you can run on any server you want in order to import the schema (with or without the data).
Right click on you database.
Select Tasks > Generate scripts
Click Next
Choose Script entire database and all database objects
Select Save to file and Single file
If you want to export data as well, click on Advanced and change Types of data to script to Schema and data (default is schema only)
Click Next ... Next.
Run the generated file on the server you want to import the schema to.