Can I connect between tables in different databases using Sequel?

I am creating software for integration between two different systems. I have Clients in a database and Groups in another. One Client can be in several groups, and one group can have several clients. So, I created a named intermediate table clients_groups

to represent this relationship.

My models are as follows:

DB1 = Sequel.connect(adapter: 'postgresql'...)
DB2 = Sequel.connect(adapter: 'tinytds'...)

class Client < Sequel::Model
  set_dataset DB1[:clients]

  many_to_many :groups, left_ley: :client_id, right_key: :group_id, join_table: :clients_groups, left_primary_key_column: :id
end

class Group < Sequel::Model
  set_dataset DB2[:groups]

  many_to_many :clients, left_ley: :group_id, right_key: :client_id, join_table: :clients_groups, right_primary_key_column: :id
end

      

This statement works:

Client.last.groups

While this is throwing an error:

Group.last.clients # => Sequel::DatabaseError: TinyTds::Error: Invalid object name 'CLIENTS_GROUPS'

What am I doing wrong?

+3
ruby sql-server postgresql orm sequel


source to share


No one has answered this question yet

Check out similar questions:

1252
What is the difference between varchar and nvarchar?
1150
Get the size of all tables in a database
894
Difference between JOIN and INNER JOIN
793
Update table using JOIN in SQL Server?
788
How can I get a list of all tables in a database using TSQL?
636
What's the difference between JPA and Hibernate?
519
What is the difference between char, nchar, varchar and nvarchar in SQL Server?
502
What's the difference between equals ?, eql ?, === and ==?
476
Difference between rake db: migrate db: reset and db: schema: load
362
What's the difference between temp variable and table variable in SQL Server?



All Articles
Loading...
X
Show
Funny
Dev
Pics