Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

QueryBuilder For with Links throws EdgeDBErrorException #32

Open
Syzuna opened this issue Sep 13, 2022 · 0 comments
Open

QueryBuilder For with Links throws EdgeDBErrorException #32

Syzuna opened this issue Sep 13, 2022 · 0 comments

Comments

@Syzuna
Copy link

Syzuna commented Sep 13, 2022

Summary

When trying to do a bulk insert with a for the query builder creates a faulty query that results in an EdgeDBErrorException.

Code

        return await QueryBuilder
            .For(factions, faction => QueryBuilder.Insert(faction, false))
            .ExecuteAsync(_edgeDb, token: cancellationToken);

Stacktrace

EdgeDB[1] Failed to execute query EdgeDB.EdgeDBErrorException: object type or alias 'default::TLIZEJSNTVCU_d1' does not exist    at EdgeDB.EdgeDBBinaryClient.<>c__DisplayClass49_1.<ExecuteInternalAsync>g__parseHandlerPredicate|2(IReceiveable packet)    at EdgeDB.ClientPacketDuplexer.<>c__DisplayClass31_0.<NextAsync>b__0(IReceiveable t) --- End of stack trace from previous location ---    at EdgeDB.ClientPacketDuplexer.NextAsync(Predicate`1 predicate, Boolean alwaysReturnError, CancellationToken token)    at EdgeDB.ClientPacketDuplexer.DuplexAsync(Predicate`1 predicate, Boolean alwaysReturnError, CancellationToken token, Sendable[] packets)    at EdgeDB.EdgeDBBinaryClient.ExecuteInternalAsync(String query, IDictionary`2 args, Nullable`1 cardinality, Nullable`1 capabilities, IOFormat format, Boolean isRetry, CancellationToken token)

Generated Query

for faction in json_array_unpack(
  <json>$YAZBVRJPGFFH
)
union (
  insert Faction {
    name := <str>json_get(
      faction,
      'Name'
    ),
    is_player_faction := <bool>json_get(
      faction,
      'IsPlayerFaction'
    ),
    allegiance := <str>json_get(
      faction,
      'Allegiance'
    ),
    government := <str>json_get(
      faction,
      'Government'
    ),
    home_star_system := (
      select TLIZEJSNTVCU_d1 offset <int64>json_get(
        faction,
        'HomeStarSystem',
        'TLIZEJSNTVCU_depth_index'
      )
      limit 1
    )
    if json_typeof(
      json_get(
        faction,
        'HomeStarSystem'
      )
    )
    != 'null' else <StarSystem>{}
  }
)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant