Primary Keys using Integration Studio

Primary Keys using Integration Studio


I have to use an existing database model that does not have auto number primary key. Is it possible to define multiple primary keys on integration studio, according to the existing model? Or do I have to use advanced queries to use the existing database?

Thanks in advance!
Hi Paulo

I'm assuming that when you say "define multiple primary keys", you are talking about defining one primary key made of multiple Attributes (columns).

In fact, in the OutSystems Platform, primary keys must have a single Attribute (column) - Integer or Text.
Anyway, in most cases, this should not be a problem. In Integration Studio, you may introspect the Entity through the wizard or manually define it.

If there IS another single Attribute that has also unique Ids (for example, has a unique index), you may define that attribute as your Identifier (primary key), and of you go.

If there IS NOT another Attribute that has also unique Ids, just define the Entity as not having an Identifier. After this, you may reference it in Service Studio. You'll notice that you'll have only the <Entity>Create entity action.

You will be able to create new rows using this entity action and use simple queries for most cases as usual or advanced queries. To update or delete rows, you'll not be able to use the entity actions (as they are not available). For these operations, use advanced queries with parameters.

Good luck!