How to union multiple data source (database and CSV) in Tableau - union

Does anyone know how to union multiple data sources with same data structure in Tableau?
i would like to union 1 csv/excel and 1 table from mysql.
I have tried the outer join between them but no luck.
Thanks

You can use data blending to use multiple data source in a single one.
Link :https://onlinehelp.tableau.com/current/pro/desktop/en-us/multiple_connections.html

Related

Using Merge Join in SSIS to merge two similar tables

I have two tables on two different servers that have identical schemas. For simplicity, let's say each table has 3 fields. I am trying to create a SSIS package that takes the data from both tables and merges it into one recordset.
I added two OLE DB sources, which get the same three fields from the two tables. I then have a Sort transformation on each, that then flows into a Merge Join. I set the join type to "Full Outer Join" on the Merge Join. I can select all six of the fields and see the output using a Data Viewer coming out of the Merge Join.
Let's say there were 25 records in each source table. In the Data Viewer, I end up getting 50 records - 25 with NULL in the last three fields, and 25 with NULL in the first three fields. I would like the output to be 50 records with data in only three fields. What I am doing wrong here? Should I be using some other sort of merge option?
I would greatly appreciate any suggestions on how to resolve what should be a simple task. Thanks!
The output from the merge join you are using is correct since you're using a full outer join. To fix your problem, use a merge transformation instead of merge join. This will combine your two sorted data flows into one sorted data flow. You've already set up your data flow correctly from your description (it should look like this):
Documentation can be found here: https://msdn.microsoft.com/en-us/library/ms141703.aspx

Cross join in SSIS without using any DB connection

I have 2 flat file source with only one column in each.
First flat file as 1,2,3 as its data.
Second flat file as A,B,C as it data.
I want the cross join output of this into another flat file. I dont have any DB connection to use or basically I'm not allowed to use the DB connection. can I know which all transformations can help in doing this?
You can use the Merge Join transformation and use Full Outer Join for Join Type.

MSSQL Injection extracting column data from another database

I setup a test-bed application vulnerable to mssql injection and i wondered, how do i extract column data from another database? To extract column data from current database we do:
convert(int,(select columnnamegoeshere from tablenamegoeshere))--
and then to enumerate the other column data we do:
convert(int,(select columnnamegoeshere from tablenamegoeshere where columnnamegoeshere not in ('firstentryfromcolumn')))--
But if it's not inside the default database and we want to extract column data from another database, how do we do that? Thanks.
I would do a join... but, to keep it simple for you, here's your code using a different database column:
convert(int,(select columnnamegoeshere from tablenamegoeshere where columnnamegoeshere not in (select top 1 firstentryfromcolumn from otherdb.dbo.otherdbtable)))
It would be better to join the 2 tables together and exclude the records if that's possible... subqueries are usually slower and not the best way to go about it.

Loading Fact Tables with SQL Server

I'm creating a warehouse using SQL Server 2008 and Analysis Services. I've managed to create and populate the dimension tables, but I'm having a lot of trouble writing the SQL for loading the fact table. For one thing, I'm not sure how to load the keys of the fact table with the PKs from the dimension table. I tried writing a query that had a series of JOINs to get the keys and the measures I want, but the statement got so complicated that I got lost.
This is the star schema that I have to work from:
http://i.imgur.com/C3DGj.png
What am I doing wrong? I have a feeling that I'm missing something pretty basic, but I'm fairly new to this and most of the information I found online seemed to deal with using SSIS, which I don't have installed.
Any help would be appreciated.
Todays Data Warehouse Developer uses SSIS for loading dimensional models. Typically, lookups are used to convert the dimensional attribute into a key. Most of the time, the data is going to be on another server or in a flat file or something else that forces you to use an ETL tool like SSIS, but in your case, you can get it done without. If your enterprise is serious about BI, you should push to get SSIS installed and learn it.
For your situation, assuming you have a table loaded with raw facts locally, you should be able to do an insert/select.
Basically, you'll want to inner join (since you've had no problems populating the dimension tables) each dimension to the raw facts table. Something like:
INSERT trainingcentrefact
(timekey,locationkey,instructorkey,coursekey,paid,notpaid,... etc)
SELECT
t.timekey
,l.locationkey
,i.instructorkey
,c.coursekey
,rf.paid
,rf.notpaid
,... etc
FROM rawfacts rf
INNER JOIN timedimension t ON rf.time = t.time
INNER JOIN locationdimension l on rf.location = l.location
INNER JOIN instructordimension i on rf.instructor = i.instructor
INNER JOIN coursedimension c on rf.course = c.course

Querying XML columns in SQLServer 2005

There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG.
<contact>
<refno>123456</refno>
<special>a piece of custom data</special>
</contact>
The tags below contact can be different for each contact, and I must query these fragments
alongside the relational data columns in the same table.
I have used constructions like:
SELECT c.id AS ContactID,c.ContactName as ForeName,
c.xmlvaluesn.value('(contact/Ref)[1]', 'VARCHAR(40)') as ref,
INNER JOIN ParticipantContactMap pcm ON c.id=pcm.contactid
AND pcm.participantid=2140
WHERE xmlvaluesn.exist('/contact[Ref = "118985"]') = 1
This method works ok but, it takes a while for the Server to respond.
I have also investigated using the nodes() function to parse the XML nodes and exist() to test if a nodes holds the value I'm searching for.
Does anyone know a better way to query XML columns??
If you are doing one write and a lot of reads, take the parsing hit at write time, and get that data into some format that is more query-able. A first suggestion would be to parse them into a related but separate table, with name/value/contactID columns.
I've found the msdn xml best practices helpful for working with xml blob columns, might provide some inspiration...
http://msdn.microsoft.com/en-us/library/ms345115.aspx#sql25xmlbp_topic4
In addition to the page mentioned by #pauljette, this page has good performance optimization advice:
http://msdn.microsoft.com/en-us/library/ms345118.aspx
There's a lot you can do to speed up the performance of XML queries, but it will never be as good as properly indexed relational data. If you are selecting one document and then querying inside just that one, you can do pretty well, but when your query needs to scan through a bunch of similar documents looking for something, it's sort of like a key lookup in a relational query plan (that is, slow).
If you have a XSD for your Xml then you can import that into your database and you can then build indexes for your Xml data.
Try this
SELECT * FROM conversionupdatelog WHERE
convert(XML,colName).value('(/leads/lead/#LeadID=''xyz#airproducts.com'')[1]', 'varchar(max)')='true'

Resources