hello and welcome to terminus tv okay so we are going to import a csv into the database tidy it
up with some wackle queries and then export the output data again as a csv this is all part of
the episodic structure of our product roadmap you can read all about it on our blog but basically
sarah works in a widgets and gizmos company it has antiquated i.t systems and she wants to get
or her boss wants to get a unwarbled list of widgets so that he can do some analysis and he
wants to get it in the form of a spreadsheet okay so let's get started we are going to
go to the terminus db quick start on github terms db is of course open source so all of
our information is over on github i'm running windows so i'm going to do this in git bash let
me just paste that in there oh wait a second i pasted in everything and you can see that terms
db quick start already exists so let me just cd in now you can see i am already on the canary branch
if you are running this for the first time you will be on the master branch so you'll just want
to get check out canary okay the next thing we want to do is we want to make a directory called
csvs the reason we want to make this is to put the output um csv into okay so we'll just make
directory csvs okay let's just go and check to make sure that was made yes you can see there it
is made and we'll go back okay great um okay so now let's pull the container and we're going to
use this script to pull the container normally you could just do it with this however in this
case we want to set the environment variables so that terminus db mounts to the local csvs
directory that we created so that is exactly what that is going to do okay let's go back to
our um git bash and we'll just paste in that script and there you can see now and pull the
it's going a little bit slowly for some reason docker is a little bit temperamental
okay it's unable to find the image locally and now it pulls it from docker great so there we go
okay so terminal server container started and here is the location of our console so let's
just copy that go to our web page uh or go to our browser and let's just paste that in
there we go so we have a fresh terminus db and no databases in here so let's call this project
and spreadsheet and we'll call the name of the database csv for nathan and this is a
feature which is going to come once we have our hub which is coming very soon but for the
moment we can just set that to local only um and we're going to give a description of importing
and filtering and exporting a csv okay so let's create that database
okay great so there we go we've got a database set up and we have the home page of the database you
can see all the information about it here okay next thing we're going to do is this is the csv
that we're going to be using so this is the raw data and as you can see we're hosting it on the
github so it's one of our web assets so let's go and just have a look eyeball what's in there
okay so there we go and let's open it with excel to see exactly what's in the csv
okay so look here what we have we've got loads of widgets and gizmos and we've got different
dates in which they are set and as you can see there's loads of them i think there's
over a thousand here so loads of widgets and gizmos all mixed up together okay so let's go
back to our uh to our database and let's have a look at this script so what we want to do
is we want to use a waffle query to get anything that's in the category widgets and anything that
was created on this date we know that the system was set up in 1986 so anything created before then
has obviously been mis-timestamped and so we want to extract all of those mixed up widgets and and
then we're going to put it into a csv called warbled widgets okay so let's take this this
query this script and put it into our database we will i will of course put all of these um
all of these scripts below the video so you can check them there okay great um now
what am i going to give as a commit message i'm just going to say import clean and export csv
great so let's just run that query okay it was successful in 0.3 seconds
and let's go and have a look to see whether we have an export yes we have worldwide widgets
okay let's open that up and let's have a look yes great so look we have unwarbled our widgets
so all we have here is widgets that were created with the date 1970 or 101.000
so you can see we have extracted the 260 records that were associated with that query excellent
um and if we just go back to the database we can run that query again and we'll just change
the name of the csv output down here to worbled widgets 2 and we'll run the query again a similar
time and now we can see we have orbital widgets 2. so that's it there you have imported you have
filtered and you have exported a csv sarah can now email it to nathan thank you very much