Comments (7)
Whoops, this was an oversight in the quickfix I added.
from asyncqlio.
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.
I think the issue for with_name
not working is because the __set_name__
overwrites it in the constructor.
from asyncqlio.
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.
get_column
lied and never looked up columns by name; this should address that (hopefully).
from asyncqlio.
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.
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)
- Table truncation
- Table.set
- Columns fail to autoincrement HOT 3
- ddlsession.create_table does not create a table HOT 3
- Properly trap exceptions
- Track history for rows that haven't been loaded HOT 1
- Implement UPSERT
- History API
- Broken transactions don't always close properly
- DDL statements
- AttributeError: module 'asyncqlio.backends.mysql' has no attribute 'MysqlDialect' HOT 1
- Column.ilike results in AttributeError on Column.bind
- TIMESTAMP is not equal between PSQL and MySQL HOT 2
- Include decimal, double, numeric definitions HOT 1
- autoincrement property ignored on Column HOT 7
- Replace `warnings` module with `logging.warn` HOT 2
- Associative table relationships? HOT 2
- Datetime column type
- `and` in `sess.select` ignores all but last comparison HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncqlio.