Tenants

  

Can anyone tell me about Tenant in details? What is tenant user and why we need them?


A Tenant is an "instance" of your application that uses isolated data. A typical OutSystems application runs on a single tenant and the developer doesn't need to know about Tenants. You can turn on "Multi-tenant" as an eSpace property, which is especially useful if you have a Software as a Service application, although there may be some other use cases.

I'll use the company I work for as an example for multi-tenant: we sell a gym management software; each gym is a tenant; all gyms use the same application, but they can't see data from other gyms. Users are included in that isolated data I mentioned; since a user belongs to a specific tenant, when they login, they can only see that tenant's data.

What the platform does behind the scenes, for multi-tenant scenarios, is to create a Tenant _ID column in every table and then create a VIEW for each tenant, based on an SQL statement like has a "SELECT * FROM MyEntity_123 WHERE MyEntity_123.Tenant_ID = 123". These views are automatically used in queries, instead of the original tables. The platform also allows timers to be scheduled for each tenant.

Hi Pradip.

Take a look at this page from the documentation and you'll get it.

Cheers,

GM

Good explanation João

What happen if you start with a entity as a no multi tenant , some record are inserted and after that you change this entity to be a multi tenant ?

So the records inserted before will not be available more,  right ? 

Hi Tiago,

Those records will be on Users tenant. This is a tenant that exists by default in Outsystems.

Regards,

Marcelo

If you inserted records into a table and then changed it to multitenant, the Tenant_ID columns on those records will be empty, so they won't appear in any query.

Digging up this medium-old thread ;) 

Can anyone tell me when the Tenant-views are created? It seems not right after creating the tenants. Is it upon first 'use' of the tenant? Is it scheduled or via a process? 

Inquiring mind needs to know :-)

Hi,


Please find below forge url to understand Tenant.

https://www.outsystems.com/forge/component/4119/multitenantapp/?Unfollow=False


Thanks!

Hi, 

Thank you for your reply.

I know how to create and maintain tenants - our core application makes heavy use of Tenants. 

I was just wondering when the views are actually created; I found out that, after creating a new tenant the table views do not immediately exist in the database for all multi-tenant espaces with entities. So there must be some other mechanism that creates the views. I suspect it is done when calling logic that queries the database in that space, but that is just a guess. 


Hans

Hi,

OutSytems has great documentation! 

I would suggest you to attend to this class:

https://www.outsystems.com/learn/courses/45/master-class-on-multi-tenancy/?StartCourse=False

Regards,

Hi Marco, 

Thanks. I watched the video, nothing new unfortunately. I'll do some more testing to see if I can figure out what's going on behind the scenes ;)