0:00Hey it's Tim here and in today's video I'm
0:01going to be talking to you about a TDS and
0:04a TDSX file.
0:05TDS stands for Tableau Data Source File and
0:08the TDSX stands for a Packaged Tableau Data
0:10Source
0:11File. And essentially these two files are
0:12essentially the same. The first one just
0:14contains metadata about your data source
0:17and the second one contains the data and
0:19the metadata for
0:20your data source. They become really useful
0:22when you keep connecting to the same data
0:24source again
0:24and again. For example when you open up
0:26Tableau and you use Superstore Sales here
0:28on the bottom
0:29left hand side when I click on that that's
0:31actually opening a TDS file and that TDS
0:33file
0:34contains information about this particular
0:36data source which is actually an excel file
0:38on my machine. But notice it also carries
0:40metadata for example it has hierarchies, it
0:43has information
0:44about the fields, it also has things like
0:47data types baked in. So this is a really
0:49really good
0:49way of saving time if you're connecting the
0:51same data source again and again. Okay let
0:53's find out
0:54how to build one. What I'm going to do is I
0:55'm going to close Superstore Sales here and
0:57we're
0:58just going to go back to the beginning by
0:59clicking the Tableau icon so we basically
1:01reset our field.
1:02Now the key thing to remember with the
1:04Tableau Data Source File is you need to do
1:06some initial
1:07prep when you first open up the data source
1:09. So to show you this I'm going to open up a
1:11Postgres
1:12database that's running locally on my
1:14laptop. If I just type in my password here
1:17and connect what
1:18we will see is you get a bit of information
1:20about what's in the database essentially
1:22and in this
1:22particular instance what you do is you'd
1:24bring in some tables. In this case I'll
1:27bring in categories
1:28and I'll also bring in the products table
1:30as well and Tableau will try and create a
1:32relationship
1:33between those two tables. Typically it gets
1:35it right so category id from the categories
1:37table
1:38and category id from the products table
1:40relate so it's made that relationship for
1:42me which is great.
1:43I'll click close and that's immediately the
1:45first bit of information that I'd like to
1:47keep every
1:48single time I open up this sort of
1:49connection. Now if I go into the sheet and
1:52I actually start
1:53working with this data source what I'll do
1:54is I'll take an extract very quickly just
1:56so this
1:56is a little bit faster to work with. Let me
1:58just create an extract and I'll put this in
2:01the same
2:02file as we are basically creating all this
2:04information. So let me just save this in
2:07our
2:07Tableau file types directory that I've got
2:09here and you'll see that it actually
2:11creates that hyper
2:12file over here next to our other files that
2:14I showed you at the very beginning. Now if
2:17I go
2:17back one of the other things I can do is I
2:19can start to create some context in this
2:21data source.
2:22For example the unit price is actually a
2:25currency data type so if I just go to the
2:28number format
2:28and I select currency custom in this
2:31particular case I know I'm going to go
2:33thousands here
2:34and keep it to one decimal place and click
2:37ok. When I drag unit price onto rows you'll
2:39see that
2:40it keeps that formatting on the axis for me
2:42which is obviously a great thing to do. Now
2:44let me drag
2:45that back out the other thing I'd like to
2:47do is build in a hierarchy here with the
2:49category and
2:50the product so I'll click on category on
2:52the mac I'll hold command on windows it's
2:54control and I'll
2:55select product name so it selects both
2:57items and then what I'll do is I'll right
3:00click on one of
3:01the items then go to hierarchy and create a
3:03hierarchy. What this does is essentially
3:05creates
3:06a relationship between the two fields that
3:08allows me to use it like a hierarchy in the
3:10table that
3:10you can expand and collapse as you as you
3:13so fit. So let me call this a product
3:16hierarchy my spelling
3:18is awful by the way so if there's any typos
3:19I apologize I'm not going to try and fix
3:21them
3:21in this video otherwise it will take too
3:23long. So here we have category name and
3:26product name and if
3:26I actually just drag category name onto
3:29rows here and I just click plus then you'll
3:32see that the
3:32hierarchy works it collapses and expands.
3:35So we've got some information now in our
3:37data source that
3:38we'd like to make sure is available every
3:40single time. How do we create a tds file?
3:43Well the first
3:44thing to do is to just right click on the
3:45data source and if you go down here there's
3:47an option
3:48to add to save data source. Now when you
3:51actually click on this it opens up the
3:53directory where all
3:54the current saved data sources are saved
3:56and you'll notice a couple of things there
3:59's actually a
3:59folder for each version of tableau you have
4:01on your machine I have several so I have
4:03several
4:03folders and you can notice here if I go
4:05into the 2020.3 folder you'll notice that I
4:08have an
4:08American and an English file and if I go to
4:10the English file which is my version of
4:12tableau
4:13you'll notice that this is actually the
4:15home of where the superstore sales data
4:16lives.
4:17This information here is actually exactly
4:19the same if I click cancel as what I see
4:22here on the
4:23bottom left hand side so these data sources
4:25are actually coming from that directory. So
4:28if you go
4:28back by clicking the tableau icon right
4:30click and we simply save it somewhere else
4:32then we actually
4:33have that file that we can use in our own
4:35development purposes. So let's go to the
4:38desktop
4:38and I'm actually going to save it in here
4:40and I'm going to call it categories plus
4:42postgres because
4:43it's essentially the table that I'm
4:45connecting to plus the database and you can
4:47see here that
4:48the file type is a tds. To create a tds x
4:50file which I'll show you how to do in a
4:53minute you'll
4:54see that this is just a drop down option
4:56here so let's create tds file let's hit
4:58save. We're going
4:59to replace the file that's in there because
5:01we created this in the previous sort of run
5:03of this
5:03tutorial and once that's done you'll see
5:05that the file is pretty much there. There
5:08we go categories
5:09plus postgres.tds. Now essentially what a t
5:12ds is it's an XML file containing
5:15information about that
5:16data source you can actually open this in a
5:18code editor if I just quickly do that and
5:20show you.
5:20If I just in fact bring up a vs code so let
5:23me just search visual studio code here and
5:26I'm just
5:27going to open that and bring that onto the
5:28screen so you can you can see that and what
5:30I'm going to
5:30do is I'm just going to kind of resize this
5:32here so it'll take a little bit of time but
5:35it's worth
5:35just showing you how this works and if I
5:37simply just drag the tds file into vs code
5:40it opens it
5:40and understands that it's XML and you can
5:43see here that it contains information about
5:45my data source.
5:46It contains all the metadata about my data
5:48source so I can actually use this for
5:50example
5:51sometimes you know power users use this to
5:53change the metadata of their data like a
5:56connection
5:56information and so on and so forth but it's
5:58actually all available here so that's
6:00essentially
6:01all the tds file is an XML file that does
6:04several things it maintains data sources it
6:08maintains
6:09settings that you've put into the data
6:11source itself like groups hierarchies and
6:13so on and so
6:14forth. Now when you use a tds file it's
6:16slightly different so let's close this and
6:18let's close this
6:19connection here that we've just created and
6:21I'm going to show you what happens when you
6:23open a
6:24tds file. The first way to open it and I
6:26think is the best way is to simply drag it
6:28into tableau
6:29because what this does is it opens that
6:31data source in the current workbook. Let me
6:34show you
6:34I'm going to connect to superstore sales
6:36over here okay so that will be our first
6:38data source
6:39connection then I'm going to go to my tds
6:41file and I'm going to drag it in and watch
6:43what happens
6:44when I drag it into this workbook it
6:46creates a second connection at the top so
6:49if you want to
6:49bring in that data source into this
6:51connection that's the best way to do that
6:53and notice that
6:54it's maintained the hierarchy that I
6:56created previously and if I drag unit price
6:58onto rows
6:59it's also kept the formatting the number
7:01formatting that we created on this field.
7:03Okay and if I go in and I edit this data
7:06source because the tds only contains
7:09metadata about my
7:10data source I can still go in and edit
7:12those relationships so it's a great
7:14starting point
7:15for making sure everything's in the right
7:17place and you can still go in and edit that
7:19information
7:19if you need to so it's a really really
7:21powerful way of speeding up your workflow
7:23and making it
7:24efficient and easy for others to use the
7:26same data sources as you use. The last
7:28thing to show you is
7:29how to create a package tableau data source
7:32file essentially all that is is the exact
7:35same file
7:36plus the data that goes with it so if I
7:37wanted to share some information with
7:40someone who doesn't
7:40have access to the data source what I would
7:43do is I would create a package data source
7:45and file that they can then use and the
7:47powerful thing here is that it also
7:49maintains information
7:51about the original source of the data
7:53source so if that person then gets access
7:55further down the
7:55line that they can open that themselves and
7:58start working with it but until they do you
8:00simply
8:00create another alternative that they can
8:02work with so this file is slightly bigger
8:04so let me
8:04just call this package so it's obvious to
8:06see when we save it in our directory let's
8:08hit save
8:09and if I just go back here you'll see that
8:12it's this icon here so I actually created
8:15one yesterday
8:15so these two files here are package data
8:18source files okay and the best way to show
8:21you this is
8:21actually if I just go to the file sizes
8:23okay so if I go here you can see that these
8:25two this file
8:26if I just delete the hyper file because we
8:28don't need this anymore you'll see that
8:30this is 34
8:32kilobytes interestingly the package data
8:34source file is actually bizarrely smaller
8:36so there's
8:37obviously some compression going on here
8:39because the package data source file is
8:41actually a zip
8:42file so if I was to my hunch is if I
8:43actually compress this then we'll get a
8:46fair reflection
8:47of how much bigger it actually is so you
8:49see and what a what a tdsx does is it
8:51actually takes the
8:53hyper file and the tds and compresses it
8:55into a zip file so if you actually opened
8:58it with a zip
8:58file manager you'd see the two files in
9:01there and so by compressing this tds file I
9:03'm actually
9:04getting a fair reflection of how different
9:06the two files are so this is four kilobytes
9:09when it's
9:09compressed and if I actually go to the
9:11package one it's 12 okay so that's pretty
9:14much a tds and a tds
9:15tds x file so it's a bit of a tongue tw
9:18ister but that's pretty much how they work
9:21if you haven't
9:21already checked it out check out my other
9:23video on tablet bookmarks I released that
9:25just yesterday
9:26and it's part of a series on file types
9:28that I'm going to be finishing later on
9:30this week so thanks
9:32for watching if you've enjoyed this video
9:34if you found it useful be sure to share it
9:35be sure to
9:36include it in your coe and share with
9:38people who might find it useful do whatever
9:40youtubers ask you
9:41to do like subscribe whatever and if you
9:42don't like it of course let me know in the
9:44comments
9:45what you'd like to see instead and I'll
9:46catch you in the next video okay thanks for
9:48watching.