Hi Chris,

Thanks for your message. Let me see if I correctly understand this: You're
using the runtime schema / table mapping and you'd like to check what your
table X is being mapped to by some configuration? E.g. along the lines of:


Table<?> unmapped = ...
Table<?> mapped = configuration.map(table);
assertEquals("some_mapped_name", mapped.getName());


jOOQ's internals use the Tools.getMappedTable() method, which essentially
just delegates to configuration.schemaMapping().map(table). The
SchemaMapping type is deprecated, because it shouldn't be public (but you
could still use it as a workaround).

Another workaround that would go in the direction of what you suggested
(but is a bit more concise) would be to use DSLContext.render(table). This
would generate the SQL only for the table expression, without needing to
wrap it in a query. But you'll still get a string, rather than an
org.jooq.Table reference.

If that's what you had in mind, great idea! There should be a public
Configuration.map(Schema) or map(Table), etc. method (or similar). I've
registered a feature request for this:
https://github.com/jOOQ/jOOQ/issues/5987

Cheers,
Lukas

2017-03-21 0:58 GMT+01:00 'Chris Conroy' via jOOQ User Group <
[email protected]>:

> I am using jOOQ’s awesome runtime schema mapping
> <https://www.jooq.org/doc/3.8/manual/sql-building/dsl-context/runtime-schema-mapping/>
> feature, and I have a use case where I need to drop into raw SQL to hit the
> MySQL INFORMATION_SCHEMA table on a runtime-mapped table. I don’t see a way
> in the API to query the actual schema/table name for a given table. Any
> chance I’m missing something in the API here? I can temporarily workaround
> by pattern matching on the generated sql from context.selectFrom(table).
> getQuery().getSQL(); but that’s very brittle!
>
>
> ​
>
> --
> 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.
>

-- 
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