{"action":"created","issue":{"url":"https://api.github.com/repos/goldmansachs/reladomo/issues/121","repository_url":"https://api.github.com/repos/goldmansachs/reladomo","labels_url":"https://api.github.com/repos/goldmansachs/reladomo/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/goldmansachs/reladomo/issues/121/comments","events_url":"https://api.github.com/repos/goldmansachs/reladomo/issues/121/events","html_url":"https://github.com/goldmansachs/reladomo/issues/121","id":279995374,"number":121,"title":"Shared Schema Multi-tenancy","user":{"login":"Zynde","id":31379998,"avatar_url":"https://avatars3.githubusercontent.com/u/31379998?v=4","gravatar_id":"","url":"https://api.github.com/users/Zynde","html_url":"https://github.com/Zynde","followers_url":"https://api.github.com/users/Zynde/followers","following_url":"https://api.github.com/users/Zynde/following{/other_user}","gists_url":"https://api.github.com/users/Zynde/gists{/gist_id}","starred_url":"https://api.github.com/users/Zynde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zynde/subscriptions","organizations_url":"https://api.github.com/users/Zynde/orgs","repos_url":"https://api.github.com/users/Zynde/repos","events_url":"https://api.github.com/users/Zynde/events{/privacy}","received_events_url":"https://api.github.com/users/Zynde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-12-07T04:13:09Z","updated_at":"2017-12-07T22:54:01Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI've been reviewing Reladomo for use in a project but see nothing about multi-tenancy. \r\n\r\nI plan on implementing shared schema tenancy by using row level security in PostgreSQL. My original plan before coming across Reloadomo was to set a connection parameter when the connection was grabbed for use. This was to be used in PostgreSQL via a table policy that checked the value compared the the column value stored essentially creating a virtual database.\r\n\r\nI think I can do the PostgreSQL part still and the connection parameter by overriding the getConnection in say the SourcelessConnectionManager.\r\n\r\nWhere I get confused is with the Caching in Reladomo. \r\n\r\nI've read what I can on the caching and It would appear that there is a collection of indices and that matching an object in the cache must be done via a match with \"=\" or \"in\". So if the tenant id was part of an index this may work?\r\n\r\nIs there a way I can do what I want to do?\r\nHow would one use Reladomo for multi-tenancy?\r\n\r\nAny help would be greatly appreciated.\r\n"},"comment":{"url":"https://api.github.com/repos/goldmansachs/reladomo/issues/comments/350119566","html_url":"https://github.com/goldmansachs/reladomo/issues/121#issuecomment-350119566","issue_url":"https://api.github.com/repos/goldmansachs/reladomo/issues/121","id":350119566,"user":{"login":"gs-rezaem","id":12956339,"avatar_url":"https://avatars2.githubusercontent.com/u/12956339?v=4","gravatar_id":"","url":"https://api.github.com/users/gs-rezaem","html_url":"https://github.com/gs-rezaem","followers_url":"https://api.github.com/users/gs-rezaem/followers","following_url":"https://api.github.com/users/gs-rezaem/following{/other_user}","gists_url":"https://api.github.com/users/gs-rezaem/gists{/gist_id}","starred_url":"https://api.github.com/users/gs-rezaem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gs-rezaem/subscriptions","organizations_url":"https://api.github.com/users/gs-rezaem/orgs","repos_url":"https://api.github.com/users/gs-rezaem/repos","events_url":"https://api.github.com/users/gs-rezaem/events{/privacy}","received_events_url":"https://api.github.com/users/gs-rezaem/received_events","type":"User","site_admin":false},"created_at":"2017-12-07T22:54:01Z","updated_at":"2017-12-07T22:54:01Z","author_association":"CONTRIBUTOR","body":"When using the same table, the caching will not get messed up if your declared key (in the xml) matches your database's unique constraint, which presumably includes ```tenentId```. \r\n\r\nHowever, the connection/db level stuff gets interesting if you really want to put everything in the same table. The easiest thing to do would be not to enforce this database side and just do it application side. So use a single connection (pool) that has full access to the db and in the application, make sure every query has a tenentId.\r\n\r\nFor scalability, I would definitely recommend multiple schemas. Easier to backup/move/delete, etc."}}
{"actor":{"display_login":"gs-rezaem"}}