Save Saiku query to reuse later - pentaho

I'm using Pentaho with Saiku. It's usual to be exploring data and find some interesting info. I need then to save the query (columns, dimensions and filters) that resulted on that info.
But I can't find a way to do that. I'm able to click on the save button and save a *.saiku file. But when I open those files, Saiku shows an empty query, I need to select a cube and build the whole query again.
Is there an easy way to save a Saiku query and open it back, so that columns, rows and filters are already selected and the report (table or chart) is queried and presented automatically?

I had some problems saving Saiku queries recently, in the latest pentaho version. I think you can try the solution presented in http://jira.pentaho.com/browse/BISERVER-13666 that consists in moving some jar files:
Source folder: ../system/sparkl/lib
Destination folder: ../system/saiku/lib
files:
cpf-core-7.1.0.0-12.jar,
cpf-pentaho-7.1.0.0-12.jar,
cpk-core-7.1.0.0-12.jar
cpk-pentaho5-7.1.0.0-12.jar
--
Also, if you want some simpler and faster way, just for emergencies, I'd suggest you can switch your Saiku query to MDX mode and copy the resulting MDX query, so you can use it later.

Related

Google Data studio can't find the bigquery dataset after moving to a different location

I have changed the location of several datasets in bigquery. The final names have not been changed after the operation.
I can query them in the bigquery UI but data studio is raising an error (BigQuery error: Not found: Dataset xxx:yyy)
It seems that data studio is not changing the processing location.
Is there a fix or solution for this?
Here is how I solved this bug without breaking my dashboards.
Click on "Resource" -> "Manage added data sources";
Find the data source that you need to reconnect and "Edit" it;
Click on "Edit Connection" on top-left;
Click on "Custom Query" and use this template: SELECT * FROM `{project}.{dataset}.{table}`
Click on "Reconnect";
By doing this, you can preserve all your fields & tables.
After that, you can use it just like that or move back to selecting the dataset and table and reconnect again.
I've seen this and "Reconnect" does not work. The fix is to Copy the report, then it will work. Rename the old report with a (Do Not Use) suffix, then remove "Copy of" from your new report name.
You will need to reset the Share permissions to the same as the old report. Of course any links to the old report need to change too.

Updating source in PowerQuery: Azure Data Pull via ODBC

I added a source in PowerQuery via ODBC to Azure, pulling data in free form query. On top of that I designed few new columns & measures in PowerBI and created report.
All good until I want to add some more columns in the free form query. My issue is:
1. If I proceed to edit the query via editing from inside Advanced Editor, it's going to take longer time & error prone as well; testing & retesting until the query is properly written.
2. Delete the existing source, add new Spark SQL query and run it without hassle. But then, create all the existing measures & columns again in PowerBI.
I don't see any other way to edit the same existing source in a hassle free way and retain my measures & columns of PowerBI intact.
Any pointers will be helpful.Thanks!
I got the idea; guess I haven't had considered the editing of Source of the query; screenshot attached.

How to get a list of partition inside a MeasuresGroup

Is there any way to get a list of partitions inside a MeasuresGroup ?
And how can I process them with specific conditions on there name ?
Thanks for your help.
SSAS Tabular is organized in JSON format (pretty easy to read, just open the model.bim file and you will pretty fast get what you want, but as you are talking about Measuregroups you are in the word of Multidimensional cubes.)
SSAS Multidimensional is organized in XML format (I can recommend to analyze the structure of the XMLA-File of the cube to get a better understanding of the structure of SSAS MD. If you want to get your list manually this would be the way to go). How to get the XMLA-File?
Open your Cube Server in SSMS
Expand your Cube, Expand "Cubes", right click on your Cube >> "Script cube as" >> "Create To" >> "File"
Open the File with a XML Viewer. I can recommend MindFusion XML Viewer as it opens the overwhelming big XML file completely collapsed, which gives you the chance to better understand the structure
XMLA-File will look something like this and you can browse into the Partitions manually and search for your information:
As you were asking to something more flexible, what I can reccomend you is to use the AMO-library, which allows you to browse the exact XMLA-File directly on the server. Either via PowerShell or via C#. How?
DatabaseJournal.com has a very straight forward guideline on how to script dimensions with AMO. In the same fashion information about Measure Groups can be accessed. If you are interested on how to use Powershell with AMO to get a list of all the Partitions inside a Measure Group, give me a thumbs up - I can guide you a bit, but I'll leave it for now as I already spent half an hour writing this answer :-).

Some useful functions of MySQL Workbench for SQL Server management studio

Our project is moving from MySQL to MS SQL and after a long time working with MySQL Workbench I really miss some features in SQL Server Management studio (2014).
Do you know whether they exist in SSMS or there is an alternative/replacement application for SSMS to work with database?
Functions are listed below:
Generate update data script to review and to be able to copy-paste it. Do not update data when I move to another row when the table is opened for editing.
Some changes are still made in database in our project, and sometimes it's easier to add some rows manually in 5 tables, get the script, test it and run the script at production environment. I don't want to write a script for each update and I don't want to make a mistake when copying data to production server using edit table option.
Review update table script BEFORE the changes were made, not after (I am talking about Tools - Options - Designer - Auto generate change scripts).
Upload a file using select file dialog into a binary field.
Again, I know about using OPENROWSET function, just interested how to do it as I used to.
Ability to view large text fields in a convenient way in SSMS. Now I have to copy data from a field and paste it into notepad. (For example, error message with a long trace log)
Save a few tabs with some useful scripts and open all of them when I open SSMS.
Is there any way to organize tabs to be able to work with 10+ tabs more effectively? Now only 6 of them can be shown on the screen (compate it to 15 tabs in MySQL WB).
Simple 'search field' (like Ctrl+F in Excel) to be able to search data in all fields displayed on the screen.
I would appreciate any ideas.
Thank you.

extract raw SQL query from a Crystal Report .rpt file

I've got an .rpt file that I did not write and can find no documentation about. I want to be able to review the SQL that is generated from this report so that I can figure out, well, what data it was pulling and what WHERE clause parameters were used.
I can open it up and see the report layout. But when I select Database|Show SQL Query... the report tries to connect to the data source. The problem is, the data source being used is unknown to me, probably an ODBC connection used by whoever wrote the query. All I can do at that stage is 'Cancel' and I'm back to looking at the report designer.
Am I missing something? Can I get to the SQL query without connecting to the datasource? It seems like viewing the selection criteria shouldn't be dependent on a data connection.
Thanks.
version: Crystal Reports 2008
I know that this is an old thread, but I encountered this same problem. Effectively we used to have a database/application that has since been aquired by an external agency.
Although they now have the database/application they don't have access to crystal reports, so we can't just send them the old report that we used to run. Likewise we can't run it as we don't even have the database set up anywhere.... So instead our plan was just to extract the SQL code generated by the report and forward that on.
We experienced the same problem, but the solution is actually pretty simple.
If you don't have access to the original data source, just create a new 'blank' datasource (such as an ODBC connection). As long as the connection to the datasource works (i.e. it is some kind of valid datasource this it works fine). When running the 'Show SQL' option point the report to this datasource. As long as you don't try to actually run the report (and only show the SQL) the operation wont fail. This worked for our situation anyway. (Crystal Reports 2008)
(I can give more details if it helps in any way.)
It should be possible to find out some details about the existing datasource, by selecting Database > Set Datasource Location... .
As well as enabling you to change the datasource location, this should show you some information about the current datasource, such as which type of datasource is being used, and possibly (dependant on the type of driver) the name of the database. It is likely to be less helpful if (as you surmise) the datasource is ODBC, but if it uses a native driver there may be something useful.
Without the password, I'm not sure how much you can do. It seems "Show SQL Query" requires to report to run first, then generate the SQL plan.
It's not ideal, but you could go to Database > Visual Linking Expert to at least see the tables and how they are joined, and the go to the Record Selection Formula Editor and see what the custom WHERE statements are.
Viewing the SQL of a Command in a Crystal Report File
There are times you have just the report file, but not the associated database structure that the report uses.
This is common when dealing with example reports of functionality you wish to mimic.
This is a workaround ONLY to allow you to see the SQL of a Command that a Crystal Report is based on, when you don't have the underlying database connection that the report is based on.
In essence, the dialog box has to be satisfied before it will show the SQL, so we fool it with a legitimate Data Source, just not one that would work with the SQL that is actually in the SQL Command.
Why does a report use a command? Doesn't Crystal Reports have the ability to link tables?
When a Crystal Report is based on a record set that is too complex for the table linking functionality within Crystal Reports, the report can instead be based on a SQL Query, usually developed/tested in another editor tool and pasted into the command. This allows advanced SQL functions to be utilized.
If you don't already have a Data Source on your computer set up that you can connect to, you will need to build one first.
A simple Microsoft Access .mdb file saved in a simple location will suffice.
I placed mine with the path C:\A_test\test.mdb to make it easy to find.
If you don't have one, google for a sample mdb file and download it, saving it with a name and location you can remember. (You won't ever actually open this file, but just connect to it.)
Once you have the file saved, open the ODBC Administrator and create a New Data Source.
(you can get to the ODBC Administrator quickly from Start > type ODBC in the Search)
On the User DSN tab, click the Add button.
Scroll down the driver list to Microsoft Access Driver (*.mdb), select it and click the Finish button.
In the Data Source Name box, type a name (I used MyTest).
Click the Select Button and select the mdb file you saved from a previous step, click OK.
Click OK again. You will see your new Data Source listed by the name you gave it. Click OK.
You now have the data source you will need for the next steps.
Open the Crystal Report you want to see the SQL command for, and click on Database Expert button or Database>Database Expert Menu.
Under Selected Tables, right click on the Command and choose View Command
The Data Source Selection Box appears. Select the Data Source you created (or one you already use) and click the Finish button. The View Command box should open with the SQL in the left pane. Copy the SQL into your favorite text editor.
Whats happening is that the crystal reports needs a database to connect to regardless if its the original source DB or not.
Create a local database or use a database stored on a server, added it to your ODBC Datasources and use it when connecting. After a successful connection you should be able to view the SQL query without an error.