Giter VIP home page Giter VIP logo

duck-orm's Introduction

๐Ÿ’ซ About Me:

๐Ÿ”ญ I'm currently working as a Software Engineer II at @olxbr
๐Ÿ“š I am a graduate of the Computer Science course at UFCG.
๐Ÿ“š I'm doing an MBA in Full Cycle Architecture.
๐ŸŒฑ I like to study everything that involves programming, mainly web development, functional programming, software engineering and machine learning.

My Page

๐ŸŒ Socials:

LinkedIn Discord Instagram

๐Ÿ’ป Tech Stack:

Python Kotlin Java JavaScript Clojure Go TypeScript CSS3 GraphQL HTML5 Markdown AWS Cloudflare GithubPages Heroku Netlify OpenStack Express.js Expo FastAPI NPM NodeJS Spring Vue.js React Nginx AmazonDynamoDB Redis SQLite ElasticSearch KIBANA Kubernetes GRAFANA NEWRELIC VAULT PROMETHEUS Docker ESLint ElasticSearch Gradle Confluence Jira Kubernetes Prometheus Postman

๐Ÿ“Š GitHub Stats:



๐Ÿ† GitHub Trophies

โœ๏ธ Random Dev Quote

๐Ÿ” Top Contributed Repo

๐Ÿ˜‚ Random Dev Meme


duck-orm's People

Contributors

dependabot[bot] avatar lucascz37 avatar richecr avatar saintmalik avatar yurisds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

duck-orm's Issues

Method save a record being an instance

Feature description::

Currently to save a record in a table:

person_1 = Person(first_name="Teste 1", last_name="teste lastname", age=19, salary=5000)

person_1 = await Person.save(person_1)

This issue wants to add a new way to save, making it easier for the user:

person_1 = Person(first_name="Teste 1", last_name="teste lastname", age=19, salary=5000)

await person_1.save()

Need:

Make it easier for the user to save a new record.

Increase code coverage to 90%

Feature description::

Code coverage is currently only 87%, but with several files well below that coverage. The idea is to leave the overall coverage above 90% and also for each file.

image

Need:

This way we will have much better confidence about any future changes that are made to the code. Facilitating its evolution.

Implementation:

Continue test implementation as is.

Support the migrations

Feature description::

Support the migrations.

Still under development.

Need:

Useful for applications already in production

Implementation:

Still under development.

Add docs field timestamp

Feature description::

Add documentation of field Timestamp.

Implementation:

Update file /docs/fields/index.md

Models Manager

Feature description::

Create a models manager, this manager will have all the models and it will be here that it will contain several ready-made functions. As the create_tables method that will create tables regardless of having to create one table before another, it will do this automatically. It will also make it easier to create future features.

Need:

from databases import Database
from duck_orm.sql import fields as Field
from duck_orm.model import Model, ManagerModel

db = Database('sqlite:///example.db')
manager = ManagerModel()
await db.connect()

class City(Model):
    __tablename__ = 'cities'
    __db__ = db
    manager = manager

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    name: str = Field.String(unique=True)

    def relationships(self):
        self.persons = OneToMany(
            model=Person,
            name_in_table_fk='city',
            name_relation='person_city'
        )


class Person(Model):
    __tablename__ = 'persons'
    __db__ = db
    manager = manager

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    first_name: str = Field.String(unique=True)
    last_name: str = Field.String(not_null=True)
    age: int = Field.BigInteger()
    salary: int = Field.BigInteger()
    city: City = ForeignKey(model=City, name_in_table_fk='id')

# He will know that he must create the `City` table first.
await manager.create_tables()

Correction in the automatic deployment of documentation

Bug description:

Correction in the automatic deployment of documentation. Put to deploy only when merged into the docs branch

With this, when new features are added along with its documentation, the site will not be deployed before deploying the library in pypi

Expected behavior:

Deploy from the documentation site after being merged into the docs branch

Field ForeignKey: parameter improvement `name_in_table_fk`

Parameter improvement: name_in_table_fk.

Currently, this parameter serves to link with the primary key of another model.

Exemplo:

class User(Model):
    __tablename__ = 'users'
    __db__ = db

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    name: str = Field.String()

    @classmethod
    def relationships(cls):
        cls.working_day = ManyToMany(model=WorkingDay,
                                        model_relation=UsersWorkingDay)

class WorkingDay(Model):
    __tablename__ = 'working_days'
    __db__ = db

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    week_day: str = Field.String()
    working_date: str = Field.String()

    @classmethod
    def relationships(cls):
        cls.users = ManyToMany(model=User, model_relation=UsersWorkingDay)

class UsersWorkingDay(Model):
    __tablename__ = 'users_working_day'
    __db__ = db

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    users: User = ForeignKey(
        model=User, name_in_table_fk='id')
    working_days: WorkingDay = ForeignKey(
        model=WorkingDay, name_in_table_fk='id')

We want it to become:

class UsersWorkingDay(Model):
    __tablename__ = 'users_working_day'
    __db__ = db

    id: int = Field.Integer(primary_key=True, auto_increment=True)
    users: User = ForeignKey(
        model=User, name_in_table_fk=User.id)
    working_days: WorkingDay = ForeignKey(
        model=WorkingDay, name_in_table_fk=WorkingDay.id)

So it is supporting the typing of the model.

  • Change in code.
  • Change in documentation.
  • Change in tests

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.