Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 31 2019 16:42
    fantix commented #428
  • Jan 31 2019 14:11
    wwwjfy labeled #432
  • Jan 31 2019 14:11
    wwwjfy commented #432
  • Jan 31 2019 14:10

    wwwjfy on pyup-update-pytest-4.1.0-to-4.2.0

    (compare)

  • Jan 31 2019 14:10

    wwwjfy on master

    Update pytest from 4.1.0 to 4.2… (compare)

  • Jan 31 2019 14:10
    wwwjfy closed #431
  • Jan 31 2019 13:05
    diegoyosiura opened #432
  • Jan 31 2019 07:08
    aliyarly starred fantix/gino
  • Jan 31 2019 03:48
    coveralls commented #431
  • Jan 31 2019 03:41
    pyup-bot opened #431
  • Jan 31 2019 03:41

    fantix on pyup-update-pytest-4.1.0-to-4.2.0

    Update pytest from 4.1.0 to 4.2… (compare)

  • Jan 31 2019 03:41

    fantix on pyup-update-pytest-4.1.0-to-4.2.0

    (compare)

  • Jan 31 2019 01:55
  • Jan 30 2019 13:55

    wwwjfy on pyup-update-quart-0.6.10-to-0.7.0

    (compare)

  • Jan 30 2019 13:06

    wwwjfy on pyup-update-flake8-3.5.0-to-3.7.1

    (compare)

  • Jan 30 2019 13:06

    wwwjfy on master

    Update flake8 from 3.5.0 to 3.7… use latest flake8 in tests, ref… Merge pull request #430 from fa… (compare)

  • Jan 30 2019 13:06
    wwwjfy closed #430
  • Jan 30 2019 13:03
    coveralls commented #430
  • Jan 30 2019 12:58
    wwwjfy synchronize #430
  • Jan 30 2019 12:58

    wwwjfy on pyup-update-flake8-3.5.0-to-3.7.1

    use latest flake8 in tests, ref… (compare)

Fantix King
@fantix
such hooks could be added
but the create() and create_all() functions are a bit less elegant - they're copied from SQLAlchemy and manipulated to be async, so I'm overall not a big fan
nichotin95
@nichotin95
Ok. So my use case was to add a trigger right after a table is created, if the table is not created, don't do anything. I can certainly use such hooks, or write an intelligent query which checks for the presence of the trigger. Thanks for such spontaneous inputs :)
Fantix King
@fantix
oh sure
nichotin95
@nichotin95
Yeah, but currently we are not planning to add a tool like alembic in the setup as it had some limitations when I lasted tested it wit docker and kubernetes. Might add that sometime later though, after a proper understanding
Fantix King
@fantix
makes sense
the create_async or GinoSchemaVisitor.create might be the places to override
nichotin95
@nichotin95
Yeah, feels like I'm looking at the right place finally. Thanks
Fantix King
@fantix
:+1: good luck!
Dima Veselov
@dveselov
Hi guys, does anybody knows how to wrap all pytest (pytest-asyncio) + sanic/aiohttp test cases in transactions? Seems like there is multiple different event loops, and asyncpg can't work in this conditions (similar issue like I have: python-gino/gino#713)
1 reply
As alternative solution I'm already do TRUNCATE at end of each test case, but it is too slow, nearly 1 second for each test case. Transactions can improve mine test run time significally, I think.
As final solution I want have something like django test cases, where transaction starts at setup_method and rollbacks at teardown_method.
Thanks in advance.
rlundy82
@rlundy82
@ZinkLu Thanks, this worked!
ivan-pozniak
@ivan-pozniak_gitlab

Hi. May be anybody knows why sqlalchemy query execute faster then Gino query. I have this type pf code with Gino

async with db.with_bind(connecting_str) as engine:
            instructions = await Instruction.query.where(Instruction.id==int(instruction_id)
                                    ).where(Instruction.trigger_id==int(instruction['trigger_id'])).gino.first()
            await instructions.update(blocks=instruction['blocks']).apply()

. And my SQLAlchemy code:

with AlchemySession() as db:
            db.session.query(Trigger).filter(Trigger.id == trigger_id).update({'instructions_id': request['instructions_id']})
            db.session.commit()
Aleksandr
@Aleksandr_fuze_gitlab
@ivan-pozniak_gitlab
You use 2 requests with gino (getting object then updating) and one with alchemy, only updating. Furthermore, you use different conditions on queries...
ivan-pozniak
@ivan-pozniak_gitlab
@Aleksandr_fuze_gitlab How can I update my parent table with child data like in sqlalchemy?
ivan-pozniak
@ivan-pozniak_gitlab

How can we use update query in sqlalchemy

db.session.query(Trigger).filter(Trigger.id == trigger_id).update({'instructions_id': request['instructions_id']})

style for one-to-many relations?
Shall we do it without getting foreign key and then find child table with this key and after that update this row?

2 replies
ivan-pozniak
@ivan-pozniak_gitlab
Hi! If i have gino query should i always use ayncio.sleep() in the end of the query?
1 reply
Filip Mićić
@MicicFilip
@fantix hey man, first of all good job on creating Gino! I was wondering if it is possible to filter a table using someting like filter_by from sqlalchemy where you could just filter arguments without having to pass table columns? Keep up the good work, thanks in advance!
2 replies
Cobalt
@Chaostheorie
@fantix Hey, is there any maintainer for gino-quart at them moment? I would love to take care of, because I use it for multiple projects at the moment and plan to include it in a guide for gino with quart.
Fantix King
@fantix
@Chaostheorie Oh sure - I truly appreciate that! There's currently no maintainer for gino-quart yet.
Cobalt
@Chaostheorie
@fantix I will probably create a pull request with bumps to the newer versions (gino and quart) in the next days. Is there a chance of it being reviewed? If not, I would otherwise love to be a maintainer for this repo.
Is there some person to message about this
?
Fantix King
@fantix
What's your github username pls?
Cobalt
@Chaostheorie
Cobalt <@Chaostheorie>
I'm writing a guide that takes advantage of gino and quart and would like to use this package in this guide -> migrating the package with changes I already have for my projects working
Fantix King
@fantix
Invitation sent ❤️
Cobalt
@Chaostheorie
Thanks a lot
The changes will be up and tested in a few days
Fantix King
@fantix
sounds great!
Cobalt
@Chaostheorie
@fantix Would you be able to release gino-quart/v0.0.1b0 to pypi as prerelease? Tests are passing etc
Fantix King
@fantix
@Chaostheorie oh if the tag name matches the pattern, the pre-defined GitHub Action will do the release: https://github.com/python-gino/gino-quart/blob/a2f7415340c979f777dc8500f43ea3f6305e7c52/.github/workflows/test.yml#L7-L8
pls feel free to either bump the version, or change the pattern
and FYI there's already 0.1.0 out on PyPI: https://pypi.org/project/gino-quart/#history
we may want to call the next version 0.2.0b0 or something
Cobalt
@Chaostheorie
Have tried to use 0.1.1b0 but the action seems to fail
I will delete the tag and create a new one called 0.2.0b0 for this. A
Fantix King
@fantix
if the tag name matches the pattern
Cobalt
@Chaostheorie
It seems to have cut of the 'b0' part when trying to upload to pypi
Fantix King
@fantix
it's currently still v*.*.*, perhaps that's the unmatching part
Fantix King
@fantix
feel free to update the pattern
Cobalt
@Chaostheorie
This seems to be caused by poetry publishing the package not y the pattern. I will take a look at it later
Fantix King
@fantix
only bumping the tag is not enough - you need to edit this too: https://github.com/python-gino/gino-quart/blob/master/pyproject.toml#L3
Cobalt
@Chaostheorie
Oh, didn't know about this file. Thank you.
1 reply
soulilya
@soulilya
hallo! can you explain how to insert many to many data? thanks
1 reply
Erus Lawliet
@eruslawliet_twitter

Hi there, I'm new to gino, I'm trying to understand the load() to make relationships.

Let's say I have something like this:

class Board(db.Model):

    id = db.Column(
        db.Integer,
        primary_key=True,
        index=True,
    )
    topic_id = db.Column(
        db.Integer,
        db.ForeignKey('topic.id'),
        nullable=False,
    )

class User(db.Model):

    id = db.Column(
        db.Integer,
        primary_key=True,
        index=True,
    )
    nickname = db.Column(
        db.String(15),
        nullable=False,
        default='',
    )
    board_id = db.Column(
        db.Integer,
        db.ForeignKey('board.id'),
        nullable=False,
    )

class UserCard(db.Model):"

    id = db.Column(
        sa.Integer,
        primary_key=True,
        index=True,
    )
    user_id = db.Column(
        db.Integer,
        db.ForeignKey('user.id'),
        nullable=False,
    )

class Topic(db.Model):

    id = db.Column(
        sa.Integer,
        primary_key=True,
        index=True,
    )
    title = db.Column(
        db.String(40),
        nullable=False,
        default='',
    )

Is there a way to "load" the board with all the relations? I'm not sure how to do that, thanks!