Closed kamrankhatti closed 7 years ago
I have similar problem what I able to figure out. basically mongify queries without prefix (schema name) so all queries will execute successfully which are against your default schema set against your user in database, but if you try to query in other schema than syntax not supported (SQL SERVER database with multiple schema) - I am looking forward for answer
Hey Guys, sorry but not sure I can help here. I have no idea about SQL Server and the different schemas. My only recommendation is to see how Ruby on Rails works with SQL Server and the different schemas. Mongify uses ActiveRecord from Rails to make things happen.
we are handling above issue via Synonyms in SQL Server like below
create synonym EmailTemplate for services.EmailTemplate
Above command in SQL Server create transparent link. Using that you can query database with & without prefixing schema name like below
select from services.EmailTemplate select from EmailTemplate
Mongify querying database without prefix so it's works now with the help of Synonyms.
Great! this works for me.
I have different schema in
sqlserver
database when I run Mongify translation command it only translates defaultpdo
schema tables and skip columns of other schema table. When I process it, it through this error:/home/[pcname]/.rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-4.2.6/lib/active_record/connection_adapters/sqlserver/database_statements.rb:352:in
each': TinyTds::Error: Invalid object name 'userstest'.: EXEC sp_executesql N'SELECT COUNT(*) FROM userstest' (ActiveRecord::StatementInvalid) from /home/[pcname]/.rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-4.2.6/lib/active_record/connection_adapters/sqlserver/database_statements.rb:352:inhandle_to_names_and_values_dblib' from /home/[pcname]/.rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-4.2.6/lib/active_record/connection_adapters/sqlserver/database_statements.rb:341:in
handle_to_names_and_values' from /home/[pcname]/.rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-4.2.6/lib/active_record/connection_adapters/sqlserver/database_statements.rb:316:in_raw_select' from /home/[pcname]/.rvm/gems/ruby-2.1.5/gems/activerecord-sqlserver-adapter-4.2.6/lib/active_record/connection_adapters/sqlserver/database_statements.rb:311:in
block in raw_select'`is it possible to use different schema tables in Mongify?