Switch database programmability?

Switch database programmability?

  

Typically when you provide a public web service api - you would have at least two servers, 1 test server and 1 live production server and hence you would have two endpoint URL for your web service. 

But what if you want to make your web service api developer friendly and just have 1 end point and segment the data based on api authentication key used to to make the web service request. (just like stripe.com, there is only 1 endpoint)


If you wrote your code in traditionally programming language C#, Java etc, you could simply change the name of the database you want your app to work with and that is it, the problem is solved. But in outsystems what would you do?


You could duplicate your entity eSpace and then duplicate the code to tell outsystems platform where to create, update, get your data etc. but that is alot of work and ALOT of duplicate data! Can we just switch logical database programmability (for some entities not all in the same session)?

Is there a better way to do this? is there a work around to solve this problem?  

(There is another problem, you can't do API version control in outsystems either! but that is a separate problem to solve later!)





Hi Robert,

I'm not that familiar on stripe.com does it, but it seems to me that the test API is available so that you can use special CC numbers and not actually start a monetary transaction... so I'm guessing they have special logic to deal with all that. Not sure what they do with the data, though. 

I don't know your use-case, but if I had to do this, here are a few of options I'd consider:

  • If the number of entities needed was small (for instance, for stripe.com it seems it's only the transactions) I'd consider having a table on the side for sample data, and wrap accesses to the DB in order to decide which data to return.
  • Another option would be to have a flag on the data, to mark it as "real" or "test" data. The aggregates on the API could then only work with test data, if using a test API Key
  • If most of the data is different, I'd consider having a special user and segmenting the test data just like you're segment the users.

Does any of these options make sense to you? Other community members, do you have other suggestions? :)

Cheers,
R

Hello R

USER and LOOKUP tables are shared, every other tables are completely separated into its own database (TEST, PRODUCTION).


In one experiment, I tried using Database_Connect_SetConnectionStringForSession on database tables created externally (not using outsystems data modeller). However it was found I was unable to switch database in runtime due to a bug (tested on MySQL Server) http://www.outsystems.com/forums/discussion/16908/bug-found-databaseconnection-setconnectionstringforsession-broken-for-mysql-se/ 


I prefer using Outsystems Data Modeller and the most effective way to solve this problem is via SOA (service-oriented architecture approach) and then we would do some internal rerouting.

Hi Robert,

Have you considered multitenancy? Seems like it would accomplish the kind of segmentation you need, although its original purpose is to build SaaS applications, not segment test and production data...

More info here


Robert Chanphakeo wrote:

Hello R

USER and LOOKUP tables are shared, every other tables are completely separated into its own database (TEST, PRODUCTION).


In one experiment, I tried using Database_Connect_SetConnectionStringForSession on database tables created externally (not using outsystems data modeller). However it was found I was unable to switch database in runtime due to a bug (tested on MySQL Server) http://www.outsystems.com/forums/discussion/16908/bug-found-databaseconnection-setconnectionstringforsession-broken-for-mysql-se/ 



I prefer using Outsystems Data Modeller and the most effective way to solve this problem is via SOA (service-oriented architecture approach) and then we would do some internal rerouting.