GithubHelp home page GithubHelp logo

dymmond / edgy Goto Github PK

View Code? Open in Web Editor NEW
130.0 5.0 7.0 1.34 MB

๐Ÿ”ฅ The perfect ORM to work with complex databases ๐Ÿ”ฅ

Home Page: https://edgy.dymmond.com

License: MIT License

Python 99.48% Shell 0.23% Mako 0.29%
anyio asyncio database mysql orm orm-framework orm-model postgres postgresql pydantic

edgy's People

Contributors

devkral avatar djwoms avatar draew6 avatar jutasir avatar kokoserver avatar tarsil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

edgy's Issues

pkcolumns do take wrong id infos

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

double initialization of metaclasses / fields contain references to old fields

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.

ManyToMany's Related Manager is not provided on object

Discussed in #98

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.

handle cached_properties properly

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)

Select postgres schema connection

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?

Create Custom manager

When i want to create custom manager it gives me an error RecursionError: maximum recursion depth exceeded.

Screenshot from 2023-10-14 23-12-59


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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.