Coder Social home page Coder Social logo

Comments (7)

Fuyukai avatar Fuyukai commented on September 2, 2024 1

Whoops, this was an oversight in the quickfix I added.

from asyncqlio.

marcoceppi avatar marcoceppi commented on September 2, 2024

For now, I've worked around it by dropping .with_name and just creating @property decorators for the remaps. Though this is just for getting, doesn't address querying, setting, etc.

class Camp(Table, table_name='camps'):
    id = Column(Integer, primary_key=True, unique=True)
    lat = Column(Numeric(12, 8), nullable=False)
    lon = Column(Numeric(12, 8), nullable=False)

    @property
    def tal(self):
        return self.lat

from asyncqlio.

Fuyukai avatar Fuyukai commented on September 2, 2024

I think the issue for with_name not working is because the __set_name__ overwrites it in the constructor.

from asyncqlio.

marcoceppi avatar marcoceppi commented on September 2, 2024

Yeah, it seems TableMeta.__init__ calls Column.__set_name__. However, even when I override the Column name (above), during the query when mapping results to a Table object it's unable to map that lat schema column is tal Column object.

I haven't dug into that side of the code yet.

from asyncqlio.

Fuyukai avatar Fuyukai commented on September 2, 2024

get_column lied and never looked up columns by name; this should address that (hopefully).

from asyncqlio.

marcoceppi avatar marcoceppi commented on September 2, 2024

There's one last piece getting caught up, Columns created with_name don't get their table reference set. Not sure where that happens, I skimmed orm.schema.table with no real luck.

Traceback (most recent call last):
  File "test.marco.py", line 40, in <module>
    loop.run_until_complete(test())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "test.marco.py", line 33, in test
    u = await sess.select(Camp).where(Camp.id == 1).first()
  File "/home/marco/Projects/asyncqlio/asyncqlio/orm/query.py", line 310, in first
    row = await gen.next()
  File "/home/marco/Projects/asyncqlio/asyncqlio/orm/query.py", line 122, in next
    return await self.__anext__()
  File "/home/marco/Projects/asyncqlio/asyncqlio/orm/query.py", line 116, in __anext__
    return self.query.map_columns(rows[0])
  File "/home/marco/Projects/asyncqlio/asyncqlio/orm/query.py", line 352, in map_columns
    val = row.get_column_value(column, return_default=False)
  File "/home/marco/Projects/asyncqlio/asyncqlio/orm/schema/table.py", line 955, in get_column_value
    raise ValueError("Column table must match row table")
ValueError: Column table must match row table

It doesn't happen on standard Column.__init__

from asyncqlio.

marcoceppi avatar marcoceppi commented on September 2, 2024

Oh, that makes sense I'm not sure why I confused owner with psql owners and not the table name.

This unblocks me, there are nitpicks about data displays, reprs, and generate_schema, but I'll work to patch those later.

from asyncqlio.

Related Issues (20)

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.