weiznich / diesel_async

Diesel async connection implementation
Apache License 2.0
659 stars 82 forks source link

Unable to execute `COPY FROM`, likely due to missing `ExecuteCopyFromDsl` trait #158

Closed lkral-navmatix closed 5 months ago

lkral-navmatix commented 5 months ago

Setup

Versions

Feature Flags

Problem Description

What are you trying to accomplish?

Trying to use COPY FROM through diesel/diesel-async. I understand this version wasn't released yet but I was eager to test this new feature.

What is the expected output?

Being able to compile and execute:

    diesel::copy_from(example::table)
        .from_insertable(&data)
        .execute(db_conn)
        .await

What is the actual output?

Attempting to use the execute from diesel_async::RunQueryDsl results in compilation errors: the trait ``QueryFragment<_>`` is not implemented for ... the trait ``QueryId`` is not implemented for ...

Steps to reproduce

The code that triggers this is basically https://docs.diesel.rs/2.2.x/diesel/fn.copy_from.html#via-copyfromqueryfrom_insertable, just trying to use the diesel_async trait to run it with AsyncPgConnection.

It looks like diesel itself uses new trait ExecuteCopyFromDsl to execute this type of query, I can't currently see this in here so is likely missing. I can look into implementing it but not that familiar with insides of this crate so maybe someone more familiar could tackle this quicker.

Thank you

Checklist

weiznich commented 5 months ago

This is expected behavior as this is a connection and not backend specific functionality. The connection provided by diesel-async just does not provide this feature yet.

I'm closing this as this is not a bug, but a feature request. (Will also convert it to a feature request)