Exclude certain schemas/tables from connection (postgres)
I have naming conflicts between two schemas in the same postgres database.
x.Project and y.Project
become Project and Project1 (although, I believed these would get prefixed with [schema]_ in case of an conflict, which I could live with - but still not great)
My initial thought was that I could just create a new postgres role/user which does not have privileges on schema "y" because I'm not interested in anything under schema "y". Instead I can still see all the tables under schema "y".
So, is there no option to exclude certain schemas/tables from being scaffolded and visualized in the left side menu or something similar I can do to get rid of this naming conflict?
Comments
Are you using the EF Core driver in LINQPad 7? (If so, the scaffolding for Postgres is done by EF Core rather than LINQPad.)
Thanks for a swift response.
Yes, I'm using the EF Core driver in LINQPad 7.
If I'm not misstaken I believe the dbscaffold in EF (if that's what you are using) can accept a --schema parameter, but I suppose you are not using that, so this is probably spiraling towards a feature request
To acheive this, will I then have to scaffold my own DbContext and feed that to LinqPad through "Use a typed data context from your own assembly" in the "Add connecton" wizard?
Yes, that will work
Thank you so much.
One final thing. Will I need to compile my own custom assembly to use the the scaffolded DbContext or can I reference an EF Core assembly that LinqPad uses under the hood?
If that assebly exists, where can I find that?
If not, do you have any documentation for how to build a custom assembly for EF Core 6/7 db context?
See https://www.linqpad.net/EntityFramework.aspx
Hi @JoeAlbahari,
Would it be possible to include the ability to scaffold just the tables from a specific schema like this post alludes?
I'm working with a postgres database that has 100s of schemas with 1000s of tables and the scaffolding process never terminates. If I was able to pass the --schema parameter directly from the connection configuration screen, I could select a subset of tables and avoid having to create a custom dll. It would be a nice addition to the application!
Thank you!
Another option that could be supported is the --tables option which one could specify a list of individual tables instead of all tables from the schema.
I can see that being able to filter schemas and tables is important in this case because with Postgres, LINQPad relies on the inbuilt scaffolder rather than using its own. I've added the ability to list schemas and tables to include in 8.8.1. Let me know how you get along.