# Postgresql: connexion to a specific schema

**URL:** <https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693>\
**Category:** Connecting to SQL\
**Created:** [May 12, 2016, 1:21pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693 "2016-05-12T13:21:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nico\_Dv](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@Nico\_Dv](https://community.dreamfactory.com/u/Nico_Dv)\
**Post date:** [May 12, 2016, 1:21pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/1 "2016-05-12T13:21:30Z")

</div>

HI,

i’m trying to connect to a postgresql database with multiple schemas in it.  
However it looks like only the “public” schema is wired. i can only see the tables of the public schema in the “Schema manager Overview”.  
I would like to define a specific schema of my database when i create a service…maybe with the “schema” keyword in the connection string?  
Couldn’t find such an option in the documentation or in the forum.  
Has this option already been implemented in dreamfactory 2.0?

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![mattschaer](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mattschaer/32/914_2.png) [@mattschaer](https://community.dreamfactory.com/u/mattschaer)\
**Post date:** [May 13, 2016, 8:00pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/2 "2016-05-13T20:00:33Z")

</div>

Hello @Nico_Dv would it be possible for you to elaborate? I’m not sure I follow. I have a feeling this may be related to configuration either in database or perhaps the database user provided in the connection from DreamFactory to PostGres.

---

<div class="post-metadata">

**Author:** ![Nico\_Dv](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@Nico\_Dv](https://community.dreamfactory.com/u/Nico_Dv)\
**Post date:** [May 13, 2016, 10:20pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/3 "2016-05-13T22:20:22Z")

</div>

HI mattschaer and thanks for your reply  
Well in postgresql you can create multiple schemas within one database.  
MY goal is to create one service in dreamfactory from one specific schema available in a postgresql database.  
When creating a dreamfactory service from an existing postgresql database, i can only see tables coming from the default “public” schema available in postgresql databases.  
That s why i m asking myself if it could be possible to create a service connected to a specific schema available in my postgresql database.  
Hope i ve been a bit clearer…sry for my english…

---

<div class="post-metadata">

**Author:** ![Nico\_Dv](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@Nico\_Dv](https://community.dreamfactory.com/u/Nico_Dv)\
**Post date:** [May 18, 2016, 7:54pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/4 "2016-05-18T19:54:06Z")

</div>

Nobody else could answer my question?

---

<div class="post-metadata">

**Author:** ![marksim](https://avatars.discourse-cdn.com/v4/letter/m/5f8ce5/32.png) [@marksim](https://community.dreamfactory.com/u/marksim)\
**Post date:** [May 19, 2016, 8:26pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/5 "2016-05-19T20:26:32Z")

</div>

In postgresql, you can change the schemas associated with a login by using the

```
ALTER ROLE loginrole SET search_path = schema1;

```

If you create the DreamFactory service with this login, you should see only the schema in the search path.

---

<div class="post-metadata">

**Author:** ![Nico\_Dv](https://avatars.discourse-cdn.com/v4/letter/n/58f4c7/32.png) [@Nico\_Dv](https://community.dreamfactory.com/u/Nico_Dv)\
**Post date:** [May 20, 2016, 7:37am UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/6 "2016-05-20T07:37:38Z")

</div>

> [@marksim](#):
>
> ALTER ROLE loginrole SET search\_path = schema1;

This works. Thank you very much!

we can add multiple schemas like this:

ALTER ROLE loginrole SET search\_path = schema1, schema2, schema3 ;

---

<div class="post-metadata">

**Author:** ![jason.gilmore](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@jason.gilmore](https://community.dreamfactory.com/u/jason.gilmore)\
**Post date:** [April 17, 2020, 5:14pm UTC](https://community.dreamfactory.com/t/postgresql-connexion-to-a-specific-schema/2693/7 "2020-04-17T17:14:50Z")

</div>

Although this post is several years old it receives quite a bit of traffic so I wanted to provide some additional input regarding PostgreSQL configuration. When configuring a new PostgreSQL API you’ll supply the database’s hostname/IP address, database name, username, password, and finally the desired schema (see screenshot).

 ![Image 2020-04-17 at 1.10.14 PM](https://canada1.discourse-cdn.com/flex035/uploads/dreamfactory/original/2X/5/527f8f4598b2c79988524313f70e645f34825ac9.png)

These 5 fields are required, however you also have quite a few additional options for tweaking the API’s behavior. Among other things you can override default driver options, the default timezone, define the character set, and enable caching.
