SQL Server meta() scannning all catalogs and schemas

19 views
Skip to first unread message

Megan A

unread,
Oct 15, 2020, 5:15:42 PM10/15/20
to jOOQ User Group

Hi,

It looks like meta() scans all catalogs and all schemas on every call. I'd really like to to only scan one schema. As I don't control the other schemas and it can become a slow query when an unrelated database has lots of tables. Is there a way to say "Only grab metadata from this one schema"? Better yet, "Only grab the metadata for this one table" would be even better.

Thanks,

Megan

Lukas Eder

unread,
Oct 16, 2020, 4:37:53 AM10/16/20
to jOOQ User Group
Hi Megan,

Thanks for your message. You can iterate the results and query them from there, such as:

for (Catalog catalog : meta().getCatalogs())
  if (catalog.getName().equals("database_name"))
    for (Schema schema : catalog.getSchemas())
      if (schema.getName().equals("schema_name"))
        for (Table<?> table : schema.getTables())
          doSomething(table);

Starting from jOOQ 3.14, there will also be Meta.filterSchemas() and similar methods to allow for filtering schemas for the entire scope of a Meta reference:

I hope this helps,
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 jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/278a4d71-bedb-4862-b89e-17407db9da37n%40googlegroups.com.

Megan A

unread,
Oct 19, 2020, 12:08:37 PM10/19/20
to jOOQ User Group
Yes thank you! I do look forward to filterSchema though.

Lukas Eder

unread,
Oct 19, 2020, 12:11:36 PM10/19/20
to jOOQ User Group
Will be released tomorrow, unless any showstoppers show up during the build!

Reply all
Reply to author
Forward
0 new messages