2014-04-25 13:12 GMT+02:00 Trygve Laugstøl <[email protected]>:

> kl. 21:50:45 UTC+2 torsdag 24. april 2014 skrev Lukas Eder følgende:
>>
>> Hello Trygve
>>
>> 2014-04-22 20:11 GMT+02:00 Trygve Laugstøl <[email protected]>:
>>
>> Hi
>>>
>>> I was wondering if it is possible to select tables and columns in an
>>> easier way than a single regex as described in [1].
>>>
>>> We have over 150 tables in our schema, and I'd like to select a small
>>> subset of the tables and subset of the columns in the selected tables.
>>> Right now my <includes> line in the pom.xml is 430 characters long and very
>>> hard to maintain. The reason for selecting the columns too is that some of
>>> our tables have many columns and we're expecting non-relevant columns to
>>> change a lot and when JOOQ does selects it touches all the columns. I
>>> really like the record way of doing it so I'd rather just limit the number
>>> of columns available in the record.
>>>
>>> So the question is if there is a better way to write the "includes"
>>> regex, like for example:
>>>
>>> <includePatterns>
>>>   <include>my_table.*</include>
>>>   <include>my_other_table.(id|from|to)</include>
>>> </includePatterns>
>>>
>>
>> Yes, something like this was requested before. I cannot seem to find the
>> relevant thread in the user group, though.
>>
>> Essentially, these "multi-include" elements are just the same as a more
>> sophisticated regex (don't forget to escape periods. Just in case):
>>
>> my_table\.*|my_other_table\.(id|from|to)
>>
>>
>> I wonder if we should allow for ignoring whitespace and allowing comments
>> in regexes using http://docs.oracle.com/javase/7/docs/api/java/util/
>> regex/Pattern.html#COMMENTS
>>
>>   my_table\.*                  (?# This is a comment)
>> | my_other_table\.(id|from|to) (?# This is another comment)
>>
>>
> If you can get it to ignore the whitespace it would be easier, but I still
> think a list of <include> elements would be easier to understand.
>

It might be easier to understand, but then again, several <include>
elements are semantically equivalent to regex unions / pipes, so I'd like
to avoid implementing this - specifically because regexes in the code
generator configuration are ubiquitous. We'd have to adapt all the other
places too, to have a consistent API.

Allowing for ignorable whitespace and comments seems more efficient and
easier to maintain.


> I tried the my_table\.* syntax, but couldn't get it to work. What's
> missing from the documentation is what the input strings actually look
> like. From what I could understand from my experiments is that the
> unqualified column names (i.e. only "id", not "my_table.id") are in the
> list, not the qualified names.
>

That's true, this part could again use some improved documentation. I have
created #3204 for this:
https://github.com/jOOQ/jOOQ/issues/3204


>
> As far as I understand the current implementation, it throws all table and
>>> column names (if includeExcludeColumns is set) in a single big list and
>>> picks out all objects that the regex matches. This might lead to failures
>>> for me as I can't pick out a column called "from" in one table, but skip
>>> the "from" field in another table. It's either both or none from what I can
>>> tell.
>>>
>>
>> Hmm, by fully qualifying things, you should be able to include "from"
>> only in one table?
>>
>
> Yes, I should. I'll try again.
>

Let me know if you encounter more issues,

Best,
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to