Giter Club home page Giter Club logo

tortoise-orm-stubs's Introduction

tortoise-orm-stubs

Type stubs that make tortoise-orm a bit easier to work with when using type checkers.

Specifically, data fields' types automatically reflect the value of null argument (i.e. become optional if you set null=True)

Installation

pip install tortoise-orm-stubs

Disclaimer

Previously tortoise-orm-stubs provided a lot more value but now the majority of its functionality has become a part of tortoise-orm. Hopefully, it will become completely unnecessary in the future.

tortoise-orm-stubs's People

Contributors

ovsyanka83 avatar zmievsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tortoise-orm-stubs's Issues

Support for foreign key id

Currently, if you have a foreign key, you can directly access it's id without using await by using _id in the name.
For example

model Comment(models.Model):
    id = fields.IntField(pk=True)
    text = fields.CharField(max_length=100)
    post = fields.ForeignKeyField('models.Post')

And when using

c = Comment(text="A comment", post=my_post)
print(c.post_id)   # type checking error (non existent field post_id) even if it should actually work.

Is there any way to handle this?

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.