Hi Mike,
I have having issues letting a subclass load a parent's relationship that
configured lazy="joined".
Let's say Engineer is a subclass of Person, and Person stores "company_id"
and has a relationship called "company" that is lazy="joined".
Although I don't have a minimal reproducible ex
Is there a way, at least, of preventing commit in every insert?
Doing that:
for datum in data:
statement=table.insert().values(**datum).returning(table.c.rowid)
inserted_rowids=conn.execute(statement)
rowid=inserted_rowids.fetchone()[0]
th
Hello Mike,
Thanks for your answer. I think I am definitely closer to find the solution
thanks to your comments, I created a new table in mssql without using any
pre-existing schema and also making sure it has a primary key. I managed to
find that table using the code I showed you above and m
Also, there are some restrictions in my setup such that I am not able to
use eager load like session.query(Engineer).options(joinedload(...)).get().
I retrieve the engineer object using another relationship.
On Thursday, November 28, 2019 at 5:45:46 PM UTC+8, Carson Ip wrote:
>
> Hi Mike,
>
> I
Sure, use an explicit transaction:
https://docs.sqlalchemy.org/en/13/core/connections.html#using-transactions
with connection.begin() as trans:
# might as well lift this out of the loop
insert = table.insert()
for datum in data:
statement = insert.values(**datum).returning(tab
UPDATE!
I have gone to the mssql server, manually added a new primary key to the
table I was looking for.
I used the following SQL code if anyone is interested:
ALTER TABLE AssetCashFlows
ADD ID INT IDENTITY;
## Then I had to do a second query, to transform ID into a primary key.
ALTER TA
Thank you!
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message be
On Thu, Nov 28, 2019, at 4:45 AM, Carson Ip wrote:
> Hi Mike,
>
> I have having issues letting a subclass load a parent's relationship that
> configured lazy="joined".
>
> Let's say Engineer is a subclass of Person, and Person stores "company_id"
> and has a relationship called "company" that
I have the following query:
min_values = (
sa.select(
[
table.c.region_id,
table.c.operator,
table.c.day_str,
sa.func.min(table.c.processed_time).label('min_processed_time'),
]
)
.group
On Thu, Nov 28, 2019, at 4:31 PM, Zsolt Ero wrote:
> I have the following query:
>
> min_values = (
> sa.select(
> [
> table.c.region_id,
> table.c.operator,
> table.c.day_str,
> sa.func.min(table.c.processed_time).label('min_processed_time'),
> ]
> )
> .group_by(table.c.region_id, tabl
10 matches
Mail list logo