Re: Dysfunctional Relationship?

2020-02-12 Thread BeeRich33
Excellent.  Thank you.  

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/4eab564f-2f8f-4f4d-9c41-00532e97e53d%40googlegroups.com.


Re: Dysfunctional Relationship?

2020-02-12 Thread Jeremy Evans
On Wednesday, February 12, 2020 at 10:32:02 AM UTC-8, BeeRich33 wrote:
>
> OK, just found something here.
>
> I have two connections going on.  My projects have different connections 
> belonging to different constants such as DR and DBL.  DBL was ahead of this 
> DR I have here.  I moved DR above DBL (which has no :user table), and it 
> worked.
>
> Can I not have multiple connections open?  
>

Multiple connections open is fine.  In this case you are talking about 
multiple Database objects, each of which can have multiple open connections 
(connections are created as needed).  Your issue here is that the first 
Database instance you create becomes the default for models where you do 
not specify the Database instance.
 

> I can see a possible conflict where two databases can have the same table 
> name.  In that class declaration, Can I provide a database and table name 
> as parameters instead of the sole table name?
>

You can provide a dataset instead of a table name:

  class User < Sequel::Model(DR[:user])
  end

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/dde1dd2c-3414-46c2-8db9-80ab131131e2%40googlegroups.com.


Re: Dysfunctional Relationship?

2020-02-12 Thread BeeRich33
OK, just found something here.

I have two connections going on.  My projects have different connections 
belonging to different constants such as DR and DBL.  DBL was ahead of this 
DR I have here.  I moved DR above DBL (which has no :user table), and it 
worked.

Can I not have multiple connections open?  

I can see a possible conflict where two databases can have the same table 
name.  In that class declaration, Can I provide a database and table name 
as parameters instead of the sole table name?

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/f0b5a512-579c-4ef7-97af-080659eed7be%40googlegroups.com.


Dysfunctional Relationship?

2020-02-12 Thread BeeRich33
Hi there.  

I've declared a connection, which I have tested:

puts DR.inspect
DR[:user].each do |i|
  ap i
  puts
end

Works fine.  

I go to declare a class and that relationship is missing:

class User < Sequel::Model(:user)
end

PG is indicating the relation is missing:

ERROR:  relation "user" does not exist (PG::UndefinedTable)
LINE 1: SELECT * FROM "user" LIMIT 1

How does it disappear?  How can I fix this?

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/02b89bbe-fdb3-43f2-9cf9-09e652e38f5f%40googlegroups.com.