Mar 10 00:29
Mar 10 01:09
Mar 10 01:22
Mar 10 02:09
Mar 10 03:17
jeremyevans joined #sequel
Mar 10 04:25
Mar 10 05:26
merboutpost joined #sequel
Mar 10 07:56
Mar 10 08:24
Mar 10 08:56
Mar 10 09:27
Swimming_Bird joined #sequel
Mar 10 09:53
Mar 10 11:10
Mar 10 11:19
dirtmcgirt joined #sequel
Mar 10 11:46
Mar 10 12:00
Mar 10 12:31
Mar 10 12:43
Mar 10 12:48
hello all. trying to use sequel with oracle XE, are there any limitations?
basically the SQL generated for an ALTER TABLE is different from the expected
Mar 10 13:57
Mar 10 14:05
djanowski: I've never tried. I know there are Sequel users using Oracle, but it wouldn't surprise me if not all ALTER TABLE commands work on Oracle.
djanowski: I don't have access to an Oracle installation, so I can't test it
jeremyevans: yeah it looks like it's not working. there's a slight difference when you add a column. nevermind, i'll test with the team and hopefully we can come up with a patch
jeremyevans: a good patch would mean some refactoring on alter_table_sql
otherwise it's hard to override for a single case
djanowski: In general, you should just have to override it in the shared Oracle adapter
djanowski: That's what the other adapters do
jeremyevans: override the whole method?
djanowski: The probability that it requires a change to Sequel core is unlikely
djanowski: Basically, you just override it to handle the cases that need to be handled differently, and call super for the other cases
djanowski: Look how it is overridden in the other shared adapters
jeremyevans: still not very clean, in this case we'd only need to override one part of the `case`, not the whole ALTER TABLE statement
djanowski: Which particular case isn't working?
jeremyevans: ALTER TABLE "table" ADD COLUMN "foo" INTEGER
jeremyevans: that's what sequel is trying to execute
Mar 10 14:10
djanowski: What's the Oracle syntax needed?
but oracle doesn't want ADD COLUMN but simply ADD
djanowski: So you'd use case, override it for :add_column, and call super in the else
djanowski: If the ADD/ADD COLUMN distinction affected more than one database, I'd think about supporting it in Sequel core
jeremyevans: oh, sorry, no, i didn't mean that we'd need to support it
djanowski: However, if it is just for Oracle, it's better just to override the whole add_column case in the adapter
simply that using the case doesn't look very clean to me in terms of being able to easily override it
i'd be duplicating the rest of the ALTER TABLE syntax
djanowski: Yes. A whole line. Wow. :p
djanowski: Really, it's not that bad
jeremyevans: i agree, the world has other problems to worry about :)
but you do agree that it's not super clean, right?
if that line were doing more things, for example
djanowski: Yes, it could be cleaner, but there's a tradeoff there
djanowski: If it was more than one line, I might consider a core patch, but in this case, I don't think it is worth it
Mar 10 14:16
jeremyevans: ok, no problem, it's good to know beforehand
jeremyevans: thanks as always
Mar 10 15:34
jeremyevans: # File lib/sequel/adapters/shared/oracle.rb, line 114
jeremyevans: at what point does the dataset become associated with a sequence?
not sure how opts[:sequence] becomes true
djanowski: The sequence method (called manually), see line 129
jeremyevans: right, so Sequel::Model never uses it when inserting a new record?
Mar 10 15:41
jeremyevans: a bit more `ack`ing shows this: set_dataset dataset.sequence(:seq_albums_id)
djanowski: If using Sequel::Model's with Oracle, I believe you need to set the sequence on the dataset so that the correct primary key value is returned when creating records
djanowski: This isn't required on most other databases
jeremyevans: is this something that could be somehow built in? maybe the adapter would be able to set the dataset?
djanowski: If there's a good way to determine the sequence for a given table automatically, I wouldn't be against doing that
djanowski: That's how the postgres adapter works.
djanowski: But I don't know how to do it on Oracle, or have any ability to test it, and nobody has contributed any code to do so
djanowski: So on Oracle, it needs to be set manually
checking the postgres adapter now
jeremyevans: would you be interested in getting access to an oracle instance to run all of the sequel suite on it?
Mar 10 15:46
jeremyevans: is there a way how to run migration to see the SQL but not execute the migration?
merboutpost: You'd have to setup a dummy database
merboutpost: Getting the SQL is easy, just add a logger
merboutpost: But making it so it doesn't execute is tricky
jeremyevans: no problem, just quick reality check :-)
merboutpost: Generally, if you have a test database, just run it on that with a logger
jeremyevans: yep that what i do, well I do sequel -E currently
merboutpost: sequel -E just adds a standard output logger :)