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
you may want to login psql and see current active connections?
jawahar
@jawahar273
What might be the per connection do the problem I am sorry I have very little idea about this
Fantix King
@fantix
if the number of active connections reaches the limit, new connection attempt will raise this error
jawahar
@jawahar273
I don't see any field with related to connection
Fantix King
@fantix
@jawahar273 from pg_stat_activity? Each row is one connection
jawahar
@jawahar273
Tq @fantix
Fantix King
@fantix
np
jawahar
@jawahar273
Pls update the doc for dB url DSN in env variable I have hard time in finding and using db.
Fantix King
@fantix
DSN in env variable?
Could you please share a link for that?
jawahar
@jawahar273
https://python-gino.readthedocs.io/en/latest/sanic.html in this page u have explain like DB_HOST etc. But u did not explicaty mention about ENV variable SANIC_DSN_URL
Yeah I think we are missing the docs for DB_DSN in Sanic extension docs.
jawahar
@jawahar273
Yup
greaber
@greaber
Hi! I'm new to Gino. I was just wondering, Postgres has a feature called "schemas", which is like a namespacing layer inside a database (https://www.postgresql.org/docs/11/ddl-schemas.html). What is the best way to work with them in Gino?
Tony Wang
@wwwjfy
@greaber Could you check if this is what you want? fantix/gino#473
greaber
@greaber
Yeah, this looks interesting, thanks!
Hide
@teamhide

Currently, I used below code for query chaining.

User.query.where(User.email == email).where(User.password == password).where(User.join_type == join_type).gino.first()

I wonder that, is it correct statement? Is there any way to querying only one where() with multiple condition?

Leo Sussan
@leosussan
Yo! Anybody using GINO / asyncpg in the Cloud Run environment to connect to a Cloud SQL instance?
Leo Sussan
@leosussan
Beginnings of a FastAPI / GINO / Postgres project generator: https://github.com/leosussan/fastapi-gino-postgres
Leo Sussan
@leosussan

@teamhide Yeah - you should use the and_ function from the sqlalchemy library.

Would look like:

from sqlalchemy import and_

await User.query.where(User.email == email).where(and_(User.password == password, User.join_type == join_type)).gino.first()
aomikhaylov
@aomikhaylov

Hello, i have smth problem with big query set:
My service receive GraphQL request and call 3-5 method like this:

        engine = self.__db_engine
        slots = []

        async with engine.acquire(reuse=True, reusable=True, lazy=True) as conn:

            for slot_model in self.SLOT_MODEL_LIST:

                query = select([Slot.id.label('base_slot_id'), Slot.agent_id, Slot.attrs_view, Slot.name, Slot.type, slot_model]).select_from(Slot.join(slot_model, slot_model.slot_id == Slot.id))

                if options.agent_id:
                    query = query.where(Slot.agent_id == options.agent_id)
                elif options.slot_id_list:
                    query = query.where(Slot.id.in_(options.slot_id_list))
                else:
                    return None

                async for slot in conn.iterate(query.order_by(Slot.id)):
                    slots.append(
                        slot
                    )

        return [dto_slot_factory.from_db_model(slot) for slot in slots] #1000 - 3000 elemets

After the query is finished, i run gc, but the process still consumes a memory. After 20-30 query, service eating 380 mb.

My db setting:

        engine = await db.set_bind(
            database_url,
            min_size=CONFIGURATION['DB_POOL_MIN_SIZE'], #1
            max_size=CONFIGURATION['DB_POOL_MAX_SIZE'], #100
            statement_cache_size=0,
        )

what can be done to free memory ?

Tony Wang
@wwwjfy
@aomikhaylov the returned list allocates memory and won't be released right? I think we can start by doing memory profiling
Denis Belavin
@LuckyDenis
Hello everyone, can anyone show examples of using group_concat?
Tony Wang
@wwwjfy
it's a MySQL feature, so doesn't seem to be related to gino. you may want to ask in PostgreSQL forum or stackoverflow.
飘尘
@ssfdust
Hello, Is anybody here?
Tony Wang
@wwwjfy
@ssfdust if you have questions, can just ask :)
Aleksandr
@Aleksandr_fuze_gitlab

Hi, I need help

from gino import Gino

db = Gino()

class MyTable(db.Model):
    __tablename__ = "test"

    id = db.Column(DB.Integer, primary_key=True)
    name = db.Column(DB.String(60), nullable=False)
    img_name = db.StringProperty()
    pin_code = db.Column(DB.String(10), nullable=True)

After starting I got raise AttributeError( AttributeError: Requires "profile" JSON[B] column
Can I use StringProperty without profile field?

Tony Wang
@wwwjfy
@Aleksandr_fuze_gitlab sorry for late reply.
StringProperty is a convenient class for the string field in a JSON or JSONB column. You can surely use something other than "profile", but we'll need a JSON or JSONB to contain that.
Or rather, I think you're looking for db.Column(db.Text()) for a string column in a db table.
Aleksandr
@Aleksandr_fuze_gitlab
I'd like to add some logic before saving the model object, something like @img_name.before_set and find a pretty solution. Currently, I redefined the method create for adding this logic but it looks not good as for me.
Tony Wang
@wwwjfy
@Aleksandr_fuze_gitlab you can achieve that by using another function or property, for example
class MyTable(db.Model):
    _img_name = db.Column("img_name", db.Text())

    @property
    def img_name(self):
        return self._img_name

    @img_name.setter
    def img_name(self, val):
        self._img_name = some logic
soulilya
@soulilya
Hallo. I try to use gino with fast api. I install asyncpg and i want to use
Alembic. I viewed issue in github but i have same errors even with right url
postgres:/user:pass@host/database
soulilya
@soulilya
With this url i have error psycopg2 not found
If i try postgresql+asyncpg i have error with
AsyncDBAPI no attribute connect
Help me please...
Tony Wang
@wwwjfy
Alembic only works with psycopg2, so for the migration to work, you have to install that
soulilya
@soulilya
Ok, thanks a lot.
soulilya
@soulilya
Hallo! Does gino supports events? I need create a record in database when new table is created
Seonu Jang
@sjquant
Hey~ awesome library~
xmrdsc
@xmrdsc
Would you reckon Gino (with asyncpg) is quite a bit faster than just using vanilla SQLa (using the full ORM) + gevent?
Tony Wang
@wwwjfy

@xmrdsc That depends by the definition of "fast" in your context. I'll say the performance of CPU resources is not the target. Coming to IO operations, it's a different story.
There are pros/cons using gevent vs asyncpg. There are a lot of discussions you can find. One related part is that using Gino now only supports psql, while gevent can "support" all other libraries.

I think it should not be too difficult to get benchmarks of both implementations.
These might be helpful: https://github.com/python-gino/gino/blob/master/docs/explanation/why.rst
python-gino/gino#420

Cezar Pauxis
@usernein
Hello! Does Gino support type HSTORE?
soulilya
@soulilya
hallo. what is values key after json serialization?
Sergey Buchko
@cepbuch_twitter

Hi there! We use Gino for aiohttp web app, but also in the same project we have some workers and cli interfaces where synchronous db calls are made. In this synchronous places I can use SQLAlchemy core for this purposes, but I'd like to use SQLAlchemyORM to work with instances of classes created with Gino db instance. I also learned that if I change Gino db.Model to Base=declarative_base() SqlAlchemyORM works perfectly (while Gino calls loose some functionality as stated in docs).

My question is:
a) is there any way to extract SqlAlchemyORM compatible object to use in synchronous query from Gino model class (__table__ doesn't suit me as queries with it act like alchemy core not orm)

b) maybe I can use Gino itself synchronously?

c) If both are negative, maybe you know another workaround other than duplicating tables?

d) maybe I miss something conceptually important and do wrong things? :)

Tony Wang
@wwwjfy
@usernein there is no special logic in Gino to support. from sqlalchemy.dialects.postgresql import HSTORE would do
@soulilya I don't get what you mean
@cepbuch_twitter use a single coroutine, then it behaves like "single thread"
seanaye
@seanaye
New to gino, like it so far! In docs it describes how to load children from a parent object. Whats the best way to do this in reverse? Load a parent from a child object.