Skip to content

Added schema field to OrmarConfig#1493

Open
hk3dva wants to merge 13 commits intoormar-orm:masterfrom
hk3dva:feature_add_schema_to_ormar_config
Open

Added schema field to OrmarConfig#1493
hk3dva wants to merge 13 commits intoormar-orm:masterfrom
hk3dva:feature_add_schema_to_ormar_config

Conversation

@hk3dva
Copy link

@hk3dva hk3dva commented Jan 26, 2026

Added use of schema in foreign keys, Many to Many
Added field to schema conversion via sqlalchemy

hk3dva and others added 3 commits January 26, 2026 16:27
Added use of schema in foreign keys, Many to Many
Added field to schema conversion via sqlalchemy
formating file
@@ -0,0 +1 @@
DATABASE_URL=postgresql://pguser:pgpassword@localhost:10011/postgres No newline at end of file
Copy link
Contributor

@MaximSrour MaximSrour Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely do not commit a .env file.

If you need to rely on a .env file, create a template (e.g., .env.example) and add .env into the gitignore.

It would also require some form of documentation in the README to explain the purpose of this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note, I didn’t notice that the original project did not have a preset ignoring env files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me personally, this functionality is necessary to build a system built for data analysis in a company. I have many different users who have their own schemes with their own rights. I would like to give them access only to their schemas, without generating configs for each of them
I also saw the issues in discussions about schema support, but no one promoted it

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 27, 2026

Merging this PR will degrade performance by 28.35%

⚡ 4 improved benchmarks
❌ 7 regressed benchmarks
✅ 73 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
test_get_one[1000] 4.7 ms 3.4 ms +38.62%
test_avg[1000] 3.9 ms 4.6 ms -15.22%
test_max[500] 2.8 ms 3.5 ms -21.61%
test_get_or_none[1000] 4 ms 4.8 ms -16.55%
test_avg[500] 3.5 ms 2.9 ms +20.3%
test_min[1000] 4.5 ms 4 ms +13.85%
test_sum[1000] 3.5 ms 4.9 ms -28.35%
test_min[500] 3 ms 3.5 ms -15.58%
test_making_and_inserting_models_in_bulk[10] 4.2 ms 5.3 ms -21.07%
test_get_or_create_when_get[500] 3.6 ms 2.5 ms +44.95%
test_exists[1000] 4.1 ms 4.8 ms -13.56%

Comparing hk3dva:feature_add_schema_to_ormar_config (0f91b4b) with master (aec3b5d)

Open in CodSpeed

@collerek
Copy link
Collaborator

Hi, looks promising but I'm missing some more query-related tests -> there is quite a complicated table and column prefixing happening under the hood to prevent colliding on the same names between tables and columns.

That's why we need to test some joins -> like select related, prefetch related, same table joins, multiple joins to the same table, accessing relationships and reverse relationships from models, and some filtering.

Between the tables in different schemas as same table schema is covered, probably also some joins to the 2 tables with same name but in different schemas. I know that it's most common use case is separation and not combining data in different schemas, but with proper permissions, that is a perfectly valid use case, so we need to make sure it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants