My suggestion is to generate your schema from the "base schema" in your dev environment, for example, to get a CUSTOMER table. And then, for customer 13, configure a Configuration / Settings that rewrites all references to CUSTOMER to CUSTOMER_DATA_13.
Obviously, you can rename tables on a per-query basis, but then you'll keep forgetting this for 1-2 queries, and it will be scattered across your code. Let me know if anything's unclear in the documentation: https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-render-mapping/ On Sat, Apr 13, 2024 at 1:12 AM Jason Bennett <[email protected]> wrote: > So, it appears that all I really need is the rename() function, but I was > surprised at the naming - I expected that function to actually rename a > table with DDL! I see that is actually under the ALTER section. > > > On Friday, April 12, 2024 at 9:58:54 AM UTC-7 Jason Bennett wrote: > >> (sorry if this gets duplicated) >> >> I guess I'm just not clear how I would do a one to many mapping in this >> situation. If I have customer 13 come in, and I need to query his table, >> I'm unclear how I can take the "standard" schema, and then say "for this >> particular query, use this schema against table customer_data_13." >> >> On Friday, April 12, 2024 at 1:51:29 AM UTC-7 [email protected] wrote: >> >>> Hi Jason, >>> >>> Unless you have complex, per-query naming logic for those tables (in >>> case of which Replacers would be a good approach), I think that your >>> use-case is still sufficiently covered by the runtime schema/table mapping >>> feature? >>> >>> https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-render-mapping/ >>> >>> Why do you think it doesn't address your problem? >>> >>> Lukas >>> >>> On Thu, Apr 11, 2024 at 10:37 PM Jason Bennett <[email protected]> wrote: >>> >>>> I have a use case where I have a certain table that is manually >>>> sharded, such that each customer account has their own copy of the table, >>>> but the schema are identical (e.g. customer_data_1, customer_data_2). In >>>> the past, it appears that static table mapping was the answer, although I >>>> don't think that actually addresses my problem. >>>> >>>> I see there is new functionality called Replacers that seems to do >>>> exactly what I want, but is commercial-only apparently. Is there similar >>>> functionality in the open-source version, or just this new feature in >>>> commercial? >>>> >>>> -- >>>> 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]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jooq-user/29ffddf7-bd3c-490b-a82d-2f9abbd6c484n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/jooq-user/29ffddf7-bd3c-490b-a82d-2f9abbd6c484n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/e751769f-72cc-4962-953f-f59533b4ff60n%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/e751769f-72cc-4962-953f-f59533b4ff60n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO4u9zVCAAjc2EgOGv23mevV%3Dj22FWKYYhFq_cnv09xfFQ%40mail.gmail.com.
