-
Notifications
You must be signed in to change notification settings - Fork 187
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
Upper/Lower Case of Column Names and other Identifiers is not preserved in some Drivers #44
Comments
I worked with Jay @PhaedrusTheGreek on this. The underlying problem is that Sequel has a downcase converter default that is applied to all field names when processing the resultset. An option is available on the Sequel class or the database connection to provide a different operation. The mechanism is .send(:symbol) so we can only use methods available on the String class. Consider adding a config to give the user a way to control what case conversion is applied to the fields from the resultset, or perhaps the resulting keys in the event. |
@PhaedrusTheGreek and @guyboertje, I am using the LogStash 2.0 and modifying the plugin_mixins/jdbc.rb with the work around line added gives the following error.
|
Ok, figured it out. Works like a charm! Under the function "prepare_jdbc_connection", add the workaround like below.
|
@guyboertje are we going to this this, or this is a jdbc mysql specific issue? Looks like we can have an extra parameter which is |
According to the documentation this will happen in many different databases, identifiers will be lowercased, so we should fix this by setting |
@gmoskovicz - I was waiting for anyone to pick this up. I thought even Jay might create a PR. Thinking about it though, the reason why Sequel makes it lowercase is to help with the datamapper and activerecord type frameworks that make the identifiers into Ruby method calls. We don't do this. We make the identifiers into string Hash keys or LS Event keys. There is no reason why they need to be lowercase, is there? Therefore we don't need a config option, we should always use to_s. Proposal: if people create their tables with mixed case identifiers then we should reflect that in the Event that is generated. |
@PhaedrusTheGreek, @gmoskovicz gimme a plus one if you agree with ^ |
+1 @guyboertje , that seems like a better default. As a workaround for any regression, i wonder if it would be possible to lowercase the identifiers in a LS filter if desired. |
👍 And also a 👍 for @PhaedrusTheGreek idea, the best option is to add a |
@gmoskovicz - it makes sense to include a config option to |
Where can I find the jdbc.rb file in logstash folder. In lib folder I have two folders bootstrap and pluginmanager but no jdbc.rb file in those folders. There is no folder like plugin_mixins. |
@srinvas i think that this should be under |
maybe |
Got it thanks @gmoskovicz @guyboertje |
change the option name and fix some typos update version and changelog Closes logstash-plugins#44
change the option name and fix some typos update version and changelog NOTE: previously Sequel downcased the column names, this is why the option lowercase_column_names defaults to true Closes logstash-plugins#44
In some driver modes, such as MSSQL, the case of column names and other identifiers is not preserved. This results in output with the incorrect key names. i.e., ColumnOne is not the same as columnone.
The Sequel library has an API to change the default behavior, but the corresponding option is not available in Logstash configuration.
In my specific case, I was losing capitalization on my MSSQL Column Names. To workaround, I modified plugin_mixins/jdbc.rb, adding the following line:
under the existing Sequel.connect line.
The text was updated successfully, but these errors were encountered: