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)

Thiago
@braindata_company_gitlab
Im using poetry install , but my own dependency is not installing
anyone knows why ?
Thiago
@braindata_company_gitlab
AttributeError: 'Config' object has no attribute 'DB_DSN'
anyone knows this error ?
Sem
@Sadbot

Hello!
How can I update some rows and return the updated models? In SQL I can write: update ... returning *
But in gino I write:

    stmt = (
        update(Model)
            .where(Model.status == "new")
            .values(status="pending")
            .returning()
    )

    return await stmt.gino.load(Model).status()

and it's returning:

('UPDATE 1', [])

One row was updated, but no models returned. Anyone knows what I do wrong?

3 replies
MasterBiryer
@MasterBiryer
Hello all,
Please bare with a gino noob, like me. I have a stupid problem: I cannot bind gino instance to a specific engine.
The problem comes from the fact I am using a framework I do not know very well and:
1/ I do not create the Gino() instance myself, although I can get the said instance
2/ But then, when I want to use it, I get a Gino engine is not initialized error
3/ But then, when I try to use set_bind() it fails because it is async
4/ But then, when I try to wait for its completion using async.run(db.set_bind(DB_URL))) it fails elsewhere with a 'cannot perform operation: another operation is in progress'
SO:
I am sure there is a 'standard way' to achieve that but I have no clue nor any pointer.
3 replies
Any comment welcome.
:D
Thank you.
MasterBiryer
@MasterBiryer
(And now Gitter will not let me init my own post :-( ...)
I wanted to say I am using asyncio, not asyncpg, if this is of any importance.
Andrii Maksymov
@amaksymov

Hi! I have some problem, I want to join Model with select query, example:

company_query = Order.select(Order.company_id).limit(10)
# then join this query with Order model, something like this:
query = company_query.outerjoin(Order, Order.company == ???).select()
orders = await query.gino.load(Order.load()).all()

How can I do that?

Fantix King
@fantix
If it was pure SQL, how would you do it pls? I just want to confirm I don't get you wrong about the question
Andrii Maksymov
@amaksymov

sorry I missed group_by

company_query = Order.select(Order.company_id).group_by(Order.company_id).limit(10)

SQL:

SELECT *
FROM (
    SELECT
           company_id
    FROM orders GROUP BY orders.company_id LIMIT 20
) as companies left join orders on orders.company_id = companies.company_id
Fantix King
@fantix
Cool, thanks! It's then a question how would you build this query with pure SQLAlchemy Core, do you want to try that first?
Andrii Maksymov
@amaksymov
OK, I'll try to build on SA Core
Andrii Maksymov
@amaksymov
My query on SA Core
company = (
    select([orders.c.company_id, ])
    .select_from(orders)
    .group_by(orders.c.company_id)
    .limit(10)
).alias("company")
order_set = select([orders, ]).select_from(
    company.join(orders, orders.c.company_id == company.c.company_id)
)
Fantix King
@fantix
Nice! Then here's how I'll do it in GINO:
```
Fantix King
@fantix
company_subquery = Order.select("company_id").group_by(Order.company_id).limit(10).alias("company")
query = Order.query.select_from(company_subquery.join(Order, Order.company_id == company_subquery.c.company_id))
not tested - but I hope it makes the point
the query is just a SQLAlchemy Core query, with GINO shortcuts
Andrii Maksymov
@amaksymov
This is it! Thanks!
Fantix King
@fantix
Thank you - I mostly copied your code :P
Aleks-Daniel Jakimenko-Aleksejev
@AlexDaniel
Hello! I'm trying to replicate this sqlalchemy query with over in gino: https://stackoverflow.com/a/50876069. Any tips? What do I use instead of session.query in this particular case?
Aleks-Daniel Jakimenko-Aleksejev
@AlexDaniel
actually, I can probably use .distinct to achieve that. Problem solved, thanks! Though I'm still curious how to get .over to work
Dương Võ
@duongvox99
Screenshot from 2021-01-19 13-04-28.png
I have some problems when using Pycharm. I import Gino from gino_starlette, defined db = Gino(app, dsn=config_database), but the IDE can not find declaration such as above image. Anyone can help me, please?
I also try with VSCode and I also have same problems
Tony Wang
@wwwjfy
@duongvox99 It's a proxy to sqlalchemy, so IDE won't be able to find that because it's done like this https://github.com/python-gino/gino/blob/7b744fa69d8672f59c602910c8e25ed39515da4c/src/gino/api.py#L370
Dương Võ
@duongvox99
Oh, can I config IDE to find this?
Tony Wang
@wwwjfy
you can import sqlalchemy and use the original Column
Dương Võ
@duongvox99

you can import sqlalchemy and use the original Column

How about some method of Gino, such as: create, get, update,.... I want IDE recommend me about it. Can you help me, please?

1 reply
Bryan Forbes
@bryanforbes
@fantix what’s the timeline on Gino 1.1.0?
Pranay Suresh
@BottleJammy_twitter
anyone using gino in production? if so, what kind of traffic?
Windreams
@NguyenMinhDung
Hello everyone, can anyone help me write query as below
with test(id) as( values(5000040,5000039,5000038)) select * from test
1 reply
wxq
@wxq0309
是不是还没支持mysql?
1 reply
John Carter
@StillSey_twitter
How to do bulk or batch update?
1 reply
verdebirth
@verdebirth
Does anyone know how to load multiple fkeys (from the same table) to a single row?
I have Transfer and Participants, Transfer has participant_a_id and participant_b_id.
Ross Rochford
@RossRochford_twitter

Hi everyone, I'm trying to connect to an existing database without redefining ORM models in Gino. Is this possible?

I'm looking for something similar to what I've been doing in sqlalchemy:

    Base = automap_base()
    engine = create_engine(connection_string)
    # reflect the tables
    Base.prepare(engine, reflect=True)
    db_session = Session(engine)
    User = Base.classes.myapp_user
    users = db_session.query(User).all()
我只是习惯了沉默
@zyxyuanxiao
@fantix 大佬你好,想咨询一个小问题,我使用db.set_bind的方式绑定连接到数据库,再使用join连表查询之后.gino.all()的列表结果进行转化到dict字典类型的~这个有什么办法的处理的吗?谢谢大佬~