dymmond / edgy Goto Github PK
View Code? Open in Web Editor NEW๐ฅ The perfect ORM to work with complex databases ๐ฅ
Home Page: https://edgy.dymmond.com
License: MIT License
๐ฅ The perfect ORM to work with complex databases ๐ฅ
Home Page: https://edgy.dymmond.com
License: MIT License
This is a short note for me:
in combination with embeddables and inheritance when having in different models different named pks I noticed a missmatch.
pkcolumns contained the wrong informations which were from a superclass.
Maybe create an helper object instead, so inheritance is guaranteed
Have a look at the fixmes in:
edgy/core/db/models/metaclasses.py of my PR feature/composite_field
and run hatch run test:test tests/fields
to see the crashes when the workaround is removed
The fields are carried over when dropping models (or maybe the fields should be remembered and only the class partly rewired). Somehow even the field attribute is remembered. This is not good.
Originally posted by edimedia May 25, 2024
Hi !
I think the related manager is not provided on object when this one is retrieved from DB, look at this:
models.py
db, registry = get_db_connection()
class World(Model):
id = fields.IntegerField(primary_key=True)
name = fields.CharField(max_length=255)
class Meta:
registry = registry
class Hello(Model):
id = fields.IntegerField(primary_key=True)
name = fields.CharField(max_length=255)
worlds = fields.ManyToManyField(World, related_name="hellos")
class Meta:
registry = registry
test_many2many_create.py
world = await World.query.create(name='Hearth')
hello = await Hello.query.create(name='King')
await hello.worlds.add(world) # It works correctly
test_many2many_retrieve.py
h = await Hello.query.get(id=1)
w = await World.query.get(id=1)
await h.worlds.remove(w) # AttributeError: 'NoneType' object has no attribute 'remove'
And when i'm looking for a sample code in edgy/tests/foreign_keys/test_many_to_many.py
, i see there's no test about retrieve (get or filter method).
Thank you.
We should check properly if a value in __dict__
is actually a cached property.
Currently there is no problem, because related_fields are the only users which needs to be escaped. But for future we have to rethink this. We may could take the column names and make an inclusive set of db_field_columns
We could also reduce the usage of cached_properties by redirecting calls to meta (needs some harmonization of attributes, which will be a breaking change)
Please tell me, how can I switch to another postgres schema when doing queries or making migrations?
In sqlalchemy we can do
async def get_session(schema_name):
async with async_session() as session:
await session.execute(f"set search_path to {schema_name}")
await session.commit()
yield session
And then use session
in api.
How to do that with edgy or saffier?
When i want to create custom manager it gives me an error RecursionError: maximum recursion depth exceeded
.
When I try makemigrations I also get Error: maximum recursion depth exceeded
error or I import the model that include this manager into esmerald shell I get same error.
Edgy version: 0.4.0
Python version: 3.10.12
OS: Ubuntu 22.04
Platform: vs code
Is it possible to generate models from existing database without writing all models myself? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.