-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of PostgreSQL schemas #163
Comments
We'll be working on this, the only reason why this isn't here yet is that PG has the rom = ROM.container(:sql, DB_URL, after_connect: -> c { c.execute("set search_path to schema1,schema2") }) |
ugh sorry I closed it by an accident, re-opened now |
Do you want to do this as part of 1.x or 2.0? |
I'd go with 2.0, there is a workaround for PG and in Oracle you can create a synonym. Supporting schemas may require some changes which I'd align with automigrations. |
Hello, |
There is any way I can help with this issue? All I see that can be problematic is that the Also, the full name of the table is not found with the This works for simple actions. schema(Sequel::SQL::QualifiedIdentifier.new('x', 'foo'), as: :x_foo) This does not works because the name is schema(:'x.foo'), as: :x_foo) |
it will require rom's identifiers to support schemas for a start, then these identifiers have to be used consistently across from and rom-sql. I tried to implement it once but I didn't succeed, it was too much work. Initially, I used search_path but then I ditched it in favor of a single schema. |
I solve the schema issue meanwhile with the search_path and am satisfied with it. |
How does it works when you have |
With my current projects, I have the situation that I design the db myself. so i can avoid this restriction. otherwise only a renaming helps, or a workaround with views. |
@flash-gordon with a little bit of guidance I could try to make it work. My only worry is that it would make identifiers more complex everywhere, whereas we only need it in rom-sql. |
I found a solution to allow I will open a PR today for the 1st part. |
@alex-lairan it'd be better to do it in 4.0.0. I'm wrapping up update-to-rom-6 branch and once it's in master, it'd be a better moment for you to work on this feature. Sounds good? |
I will have to do it anyway because it's a blocking issue for us :) |
@alex-lairan OK so let's see what you have and I'll think about how it could be backported to 4.0.0! |
@solnic I'm not sure if this is only applicable to SQL, I guess scopes like schemas/databases/etc could be found in other backends as well. Anyhow, SQL is a big part of persistence to justify the change. OTOH, rom-sql could have its own identifiers. |
I have other cases of join error with Schemas. Can anyone review my current PR? |
@alex-lairan sounds good, please add tests and I'll take care of releasing it |
@alex-lairan do you have some status/input? |
@wuarmin sorry did not had time to do it. Stay tuned :) |
It would be an improvement if we can make use of PostgreSQL schemas in rom-sql. Sequel API supports it using the double underscore special notation.
Especially for legacy tables, it would be easier to migrate to rom-sql.
The text was updated successfully, but these errors were encountered: