Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,000 --> 00:00:02,000
Instructor: So far, we've seen the process
2
00:00:02,000 --> 00:00:04,000
for connecting to and loading data from a local file
3
00:00:04,000 --> 00:00:05,000
into Power BI,
4
00:00:05,000 --> 00:00:08,000
but chances are you won't always just be working
5
00:00:08,000 --> 00:00:09,000
with flat files.
6
00:00:09,000 --> 00:00:10,000
So in this lecture,
7
00:00:10,000 --> 00:00:14,000
I'd like to cover the process of connecting to a database.
8
00:00:14,000 --> 00:00:15,000
Now, Power Query can connect to data
9
00:00:15,000 --> 00:00:18,000
from many different database sources like SQL Server,
10
00:00:18,000 --> 00:00:23,000
Microsoft Access, MySQL, Postgres, Oracle, SAP,
11
00:00:24,000 --> 00:00:25,000
and many, many more.
12
00:00:25,000 --> 00:00:28,000
And the great thing is that once you understand
13
00:00:28,000 --> 00:00:30,000
how to connect to one database,
14
00:00:30,000 --> 00:00:32,000
the process is very similar
15
00:00:32,000 --> 00:00:34,000
to connect to other database sources.
16
00:00:36,000 --> 00:00:37,000
From the Get Data window,
17
00:00:37,000 --> 00:00:39,000
you'll select the database connection you want
18
00:00:39,000 --> 00:00:42,000
and enter the database's specific credentials.
19
00:00:42,000 --> 00:00:45,000
Once you've added in the appropriate credentials,
20
00:00:45,000 --> 00:00:46,000
there's some advanced options
21
00:00:46,000 --> 00:00:49,000
that allow you to configure the command timeout
22
00:00:49,000 --> 00:00:53,000
and even write custom SQL statements to customize, limit,
23
00:00:53,000 --> 00:00:57,000
and shape the data before it's added into the query editor.
24
00:00:57,000 --> 00:00:59,000
Once these details are all set,
25
00:00:59,000 --> 00:01:02,000
we'll be able to select the specific tables
26
00:01:02,000 --> 00:01:04,000
and then load them into the query editor
27
00:01:04,000 --> 00:01:07,000
for QA, shaping, and transformation.
28
00:01:07,000 --> 00:01:08,000
So for this demo,
29
00:01:08,000 --> 00:01:10,000
I'm going to be using a database that we use
30
00:01:10,000 --> 00:01:12,000
in Maven's advanced MySQL course
31
00:01:12,000 --> 00:01:14,000
called Maven Fuzzy Factory.
32
00:01:14,000 --> 00:01:17,000
And if you've taken the MySQL course,
33
00:01:17,000 --> 00:01:19,000
you should have the community server
34
00:01:19,000 --> 00:01:21,000
installed on your machine
35
00:01:21,000 --> 00:01:23,000
and can likely follow along with this demo
36
00:01:23,000 --> 00:01:25,000
and practice the connection steps.
37
00:01:25,000 --> 00:01:27,000
Just to call this out, specifically,
38
00:01:27,000 --> 00:01:30,000
we will not be installing Community Server
39
00:01:30,000 --> 00:01:31,000
as part of this demo.
40
00:01:31,000 --> 00:01:33,000
So if you don't have it installed,
41
00:01:33,000 --> 00:01:37,000
no worries, just sit back, relax, and enjoy the demo.
42
00:01:37,000 --> 00:01:40,000
So with that, let's jump on over to Power BI
43
00:01:40,000 --> 00:01:42,000
and we'll check this out.
44
00:01:42,000 --> 00:01:45,000
All right, so from the relationship view here,
45
00:01:45,000 --> 00:01:46,000
we can come up to Get data
46
00:01:47,000 --> 00:01:50,000
and we'll click on more sources here.
47
00:01:51,000 --> 00:01:54,000
And we can actually just type in mysql to search,
48
00:01:55,000 --> 00:01:58,000
and we'll connect to our MySQL database.
49
00:01:58,000 --> 00:01:59,000
All right, so to get started here,
50
00:01:59,000 --> 00:02:02,000
we're gonna enter in our server and database name.
51
00:02:02,000 --> 00:02:06,000
And this is my local server address.
52
00:02:06,000 --> 00:02:09,000
And the database name is mavenfuzzyfactory,
53
00:02:11,000 --> 00:02:13,000
and mine is called _development.
54
00:02:16,000 --> 00:02:18,000
All right, and like we saw in the slides here,
55
00:02:18,000 --> 00:02:19,000
we have some advanced options.
56
00:02:19,000 --> 00:02:21,000
We can set a command timeout.
57
00:02:21,000 --> 00:02:24,000
Or here you could type in some custom SQL statements
58
00:02:24,000 --> 00:02:26,000
to either limit, or transform,
59
00:02:26,000 --> 00:02:29,000
or shape the data prior to importing it.
60
00:02:29,000 --> 00:02:32,000
But we're just gonna connect to the database as is.
61
00:02:32,000 --> 00:02:33,000
So click OK.
62
00:02:34,000 --> 00:02:37,000
And at this step, when we're prompted for the credentials,
63
00:02:37,000 --> 00:02:39,000
I actually want to use the database credentials.
64
00:02:39,000 --> 00:02:42,000
So I have a username and a password set up.
65
00:02:42,000 --> 00:02:46,000
And my username is root, and I'll enter my password.
66
00:02:48,000 --> 00:02:49,000
And we'll connect from here.
67
00:02:51,000 --> 00:02:55,000
Awesome, so we have our kind of preview window here, right?
68
00:02:55,000 --> 00:02:58,000
Looks similar-ish to when we connect to the CSV, right?
69
00:02:58,000 --> 00:03:02,000
Except for now, we have our different table names.
70
00:03:02,000 --> 00:03:04,000
And if we click on each one of these table names,
71
00:03:04,000 --> 00:03:07,000
we're gonna see a preview of result
72
00:03:07,000 --> 00:03:09,000
on the right-hand side, right?
73
00:03:09,000 --> 00:03:11,000
So we've got all of these different tables
74
00:03:11,000 --> 00:03:14,000
that we can click through and kind of see, right?
75
00:03:14,000 --> 00:03:18,000
And we're gonna connect to all of these tables, right?
76
00:03:18,000 --> 00:03:19,000
All six.
77
00:03:22,000 --> 00:03:24,000
And again, we've got load and transform data options.
78
00:03:24,000 --> 00:03:26,000
We're gonna click Transform Data,
79
00:03:26,000 --> 00:03:28,000
and that'll bring us back into the query editor.
80
00:03:31,000 --> 00:03:32,000
And now that we've got the data
81
00:03:32,000 --> 00:03:33,000
all loaded into the query editor,
82
00:03:33,000 --> 00:03:35,000
from here, we can go through
83
00:03:35,000 --> 00:03:37,000
all of those same kind of applied steps.
84
00:03:37,000 --> 00:03:39,000
We can update our table name,
85
00:03:39,000 --> 00:03:42,000
we can go through and check all of our data types,
86
00:03:42,000 --> 00:03:44,000
rename column headers,
87
00:03:44,000 --> 00:03:46,000
go through really all of those different QA
88
00:03:46,000 --> 00:03:49,000
and any sort of transformation steps that are needed.
89
00:03:49,000 --> 00:03:52,000
But because we're not using this data throughout the course,
90
00:03:52,000 --> 00:03:53,000
I actually don't need to perform
91
00:03:53,000 --> 00:03:55,000
any sort of transformations here.
92
00:03:55,000 --> 00:03:57,000
The one thing that I do want to do
93
00:03:57,000 --> 00:04:00,000
is I want to disable this data from being loaded
94
00:04:00,000 --> 00:04:02,000
into the data model, right?
95
00:04:02,000 --> 00:04:05,000
I'd love for it to still stay in the query editor for now,
96
00:04:05,000 --> 00:04:07,000
but I don't need it within my model.
97
00:04:07,000 --> 00:04:09,000
So if I right-click this table,
98
00:04:09,000 --> 00:04:12,000
I'm gonna click this Enable Load.
99
00:04:12,000 --> 00:04:14,000
And there's a very subtle name change here
100
00:04:14,000 --> 00:04:18,000
where the name is now italicized,
101
00:04:18,000 --> 00:04:22,000
and that indicates that it is not going to be loaded, right?
102
00:04:22,000 --> 00:04:24,000
So we'll go through each one of these
103
00:04:24,000 --> 00:04:26,000
and remove the Enable Load.
104
00:04:27,000 --> 00:04:30,000
And again, this is just a great tool to use
105
00:04:30,000 --> 00:04:33,000
when you don't want to actually load those tables
106
00:04:33,000 --> 00:04:34,000
into your data model.
107
00:04:36,000 --> 00:04:39,000
All right, so from here, we're gonna click Save,
108
00:04:40,000 --> 00:04:45,000
I'll apply my changes, and we'll be good to go.
109
00:04:45,000 --> 00:04:46,000
All right, so that is your demo
110
00:04:46,000 --> 00:04:50,000
on connecting to a SQL database.
111
00:04:50,000 --> 00:04:51,000
All right, so now that everything has saved,
112
00:04:51,000 --> 00:04:53,000
that's gonna wrap up this demo
113
00:04:53,000 --> 00:04:55,000
on connecting to a SQL database.
114
00:04:55,000 --> 00:04:57,000
Up next, we're gonna check out
115
00:04:57,000 --> 00:04:59,000
how we can actually scrape data from the web.
8945
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.