-: Hi guys and welcome back.
In this video we're going to learn
how to instal and use PostgreSQL,
although really we won't be installing it at all.
We're going to be using for this course,
a cloud PostgreSQL provider.
That means that instead of installing Postgres
in my computer,
I'm gonna use somebody else's installation on a server,
an internet connected computer.
That is because installing Postgres can be quite tricky.
There's multiple problems that can arise in the process,
so that's why we're gonna use that.
These often cost money,
but this provider ElephantSQL has a free tier
from which we can learn more about Postgres
without having to go through
the pain of installing it ourselves.
We often use these cloud providers
when we're developing applications
and they have a number of benefits
as well as convenience for cost.
You also get things like backups.
You get things like load balancing.
If you're making too many concurrent connections,
you can sort of upgrade your server
and allow for more of those for a higher cost of course.
And so there's a few benefits
that come with using a cloud provider
and the main one is of course
that you don't have to set it up yourself
and manage it yourself.
For example, if you've run out of disc space, et cetera.
So the first thing to do is to go to ElephantSQL.com
and sign up for an account.
So once you've done that,
you're gonna end up in somewhere like this.
I've already got a few Instances
or database servers running,
but you can create a new one.
It is possible that you'll see this
as the default screen when you come in
and if so, that's totally fine.
Just go ahead and give it a name.
I'm gonna give it Python/PostgreSQL 2.0 course
then select the free plan and finally
you can put in some tags
if you want to structure or organise your servers
in a specific way,
but we can leave it empty for now.
Then select the region.
Here we're gonna select a region that's near us
because the apps that we're gonna be building
in this course are gonna run in our computers
and the closer the server is to our computer,
the faster the connection is gonna go.
If we were deploying these applications
that we're building to a server
for other users to connect to,
then we would want to pick a database
that is near our users instead of near us,
but for now we're gonna leave it as that.
I'm gonna pick Ireland and that's it.
We can create the Instance after that.
All right, so once you've got your Instance created,
you can click on it
and here you're going to see details for this Instance.
We can see for example, the server.
This is the location on the internet where this database is.
This essentially resolves to an IP address
that computers can use to connect from one to another.
We've also got the user that the database is going to use.
You're gonna need this together
with the password in order to connect to the server.
As well as that, we've got the URL.
The URL contains all the information
that normally code needs to connect to a Postgres database,
so this URL contains the username,
the password, the host, the port,
that is a specific place in this IP address
where the database is running
as well as the default database.
Whenever we connect it to this URL,
we're already gonna have a database created
and we can just go in and create tables
and insert data and so forth.
Using ElephantSQL we can also run arbitrary queries using
the browser tab here on the left,
we can run our queries, execute them,
and see our output as well.
Throughout the next few chapters,
I'm going to be using the URL from my Python code
as the database URL,
So click on the 'I',
copy the whole thing as you're gonna need it
in the next few videos when we're working with Python.
If you'd rather instal Postgres SQL locally
instead of using ElephantSQL, you can do that.
I'm gonna leave a link in the resources section
of this video to the ebook where we cover
how you can instal PostgreSQL locally,
but again, sometimes there are some problems that arise
when you're doing that
and we're not really going to be able to help you with those
as they can be very dependent on the computer
that you're running and your operating system,
your versions of different things and stuff like that.
But nonetheless,
I'm gonna leave a link there that can help you out.
If instead of using this browser
you want to use your own database viewer such as PG admin
or HeidiSQL, which is the one I recommend,
then you can totally do that.
Those will need the URL
so that they can connect to your database,
but then the database will behave like any other one
that you've got installed locally.
The ebook also contains instructions on how to use HeidiSQL,
which is a database viewer,
so you can read that if you want
to use a local database viewer instead
of going through ElephantSQL.
Do note though that I will be using ElephantSQL
throughout the course.
So everything that you're gonna see me do here,
you're gonna need to use your local database viewer
if you were using that instead.
All right, now we're ready to move on to the next chapter
where we're gonna learn more
about how to interact with PostgreSQL.
So thank you for watching and I'll see you there.