# Error calling a custom postgres view from one database to another

**URL:** <https://community.forestadmin.com/t/error-calling-a-custom-postgres-view-from-one-database-to-another/6222>\
**Category:** Help me!\
**Created:** [April 27, 2023, 4:15pm UTC](https://community.forestadmin.com/t/error-calling-a-custom-postgres-view-from-one-database-to-another/6222 "2023-04-27T16:15:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptrognon](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@ptrognon](https://community.forestadmin.com/u/ptrognon)\
**Post date:** [April 27, 2023, 4:15pm UTC](https://community.forestadmin.com/t/error-calling-a-custom-postgres-view-from-one-database-to-another/6222/1 "2023-04-27T16:15:50Z")

</div>

Error calling a custom postgres view from one database to another

I am in the customization of the relations of a view which is in the postgres “core” database and I wish to add a relation to it towards a view which is in the postgres “gateway” database it tells me that it cannot find the view

* * *

Erreur dans l’appel d’une view postgres custom d’une base vers une autre

## je suis dans la customisation des relations d’une view qui se trouve dans la database postgres « core » et je souhaite lui ajouter une relation vers une view qui se trouve dans la database postgres « gateway » il me dit qu’il ne trouve pas la view

## Observed behavior

===== An exception was raised =====

```javascript
GET /forest/viewForestSouscription/067740f8-be39-4c1b-b9ad-09dd69e1c118/relationships/viewForestDocumentSignatures?{
timezone: Europe/Paris,
fields[viewForestDocumentSignature]: documentBorrowerExternalId,documentCreationDate,…
fields[viewForestSignatureTransaction]: id,
page[number]: 1,
page[size]: 15,
sort: -id
}

```

## Expected behavior

no error

## Failure Logs

===== An exception was raised =====

```javascript
GET /forest/viewForestSouscription/067740f8-be39-4c1b-b9ad-09dd69e1c118/relationships/viewForestDocumentSignatures?{
timezone: Europe/Paris,
fields[viewForestDocumentSignature]: documentBorrowerExternalId,documentCreationDate,…
fields[viewForestSignatureTransaction]: id,
page[number]: 1,
page[size]: 15,
sort: -id
}

```

## Context

**My sequelize view in database postgres core**

```javascript
module.exports = (sequelize, DataTypes) => {
    const { Sequelize } = sequelize;
    // This section contains the fields of your model, mapped to your table's columns.
    // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
    const ViewForestDocumentSignature = sequelize.define('viewForestDocumentSignature', {
        id: {
            type: DataTypes.INTEGER,
            allowNull: false,
            primaryKey: true
        },
        // cut
    }, {
        tableName: 'view_forest_document_signature',
        underscored: true,
        timestamps: false,
        schema: process.env.DATABASE_SCHEMA,
    });

    ViewForestDocumentSignature.associate = (models) => {

        ViewForestDocumentSignature.hasOne(models.viewForestSignatureTransaction, {
            foreignKey: {
                name: 'documentSignarureTransactionId'
            }
        });

    };

    return ViewForestDocumentSignature;
};

**My sequilize view in database postgres gateway**
module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;
  // This section contains the fields of your model, mapped to your table's columns.
  // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
  const ViewForestSignatureTransaction = sequelize.define('viewForestSignatureTransaction', {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true
    },
    documentSignarureTransactionId: {
      type: DataTypes.STRING,
      allowNull: false
    },
    creationDate: {
      type: DataTypes.DATE,
      allowNull: false
    },
    terminateDate: {
      type: DataTypes.DATE,
      allowNull: false
    },
    viewUrl: {
      type: DataTypes.STRING,
    },
    archivedVolume: {
      type: DataTypes.STRING,
    },
  }, {
    tableName: 'view_forest_signature_transaction',
    underscored: true,
    timestamps: false,
    schema: process.env.DATABASE_SCHEMA,
  });

  ViewForestSignatureTransaction.associate = (models) => {};

  return ViewForestSignatureTransaction;
};

```

---

<div class="post-metadata">

**Author:** ![anon7311026](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon7311026](https://community.forestadmin.com/u/anon7311026)\
**Post date:** [April 28, 2023, 8:51am UTC](https://community.forestadmin.com/t/error-calling-a-custom-postgres-view-from-one-database-to-another/6222/2 "2023-04-28T08:51:40Z")

</div>

Hello @ptrognon , and welcome to the community,

Could you please share details about your project configuration:

## Context

- Project name: …
- Team name: …
- Environment name: …
- Agent type & version: …
- Recent changes made on your end if any: …

This will be helpfull for us in order to provide a more precise response,

Thanks 🙏

---

<div class="post-metadata">

**Author:** ![ptrognon](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@ptrognon](https://community.forestadmin.com/u/ptrognon)\
**Post date:** [May 6, 2023, 3:45pm UTC](https://community.forestadmin.com/t/error-calling-a-custom-postgres-view-from-one-database-to-another/6222/3 "2023-05-06T15:45:07Z")

</div>

Hello, problem is solved with Steve.

thank you
