question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to reuse connection when using DSL?

See original GitHub issue

Each DSL operation calls self.client.execute which apparently creates a new connection each time. Passing a session to DSLSchema doesn’t work and causes an infinite recursion.

Traceback (most recent call last):
  File "gql_test2.py", line 45, in <module>
    query = ds.Query.listCasess().select(ds.ModelCasesConnection.items.select(ds.Cases.id))
  File "C:\Program Files\Python38\lib\site-packages\gql\dsl.py", line 38, in __getattr__
    type_def = self.schema.get_type(name)
  File "C:\Program Files\Python38\lib\site-packages\gql\dsl.py", line 38, in __getattr__
    type_def = self.schema.get_type(name)
  File "C:\Program Files\Python38\lib\site-packages\gql\dsl.py", line 38, in __getattr__
    type_def = self.schema.get_type(name)
  [Previous line repeated 996 more times]
RecursionError: maximum recursion depth exceeded

Is there some known good way to reuse the connection when using DSL? Is the session meant to work, and this is simply a bug?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
leszekhanuszcommented, Nov 21, 2020

Fixed in v3.0.0a5

0reactions
leszekhanuszcommented, Nov 14, 2020

I refactored the DSL code and the proposed way is a little bit different. Example:

query = dsl_gql(DSLQuery(ds.Query.hero.select(ds.Character.name)))                                                            
result = session.execute(query)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Extend DSL Service Line & Relocate Your Router
... and how to connect the wiring. Is your Wi-Fi signal weak or intermittent? The location of your router is likely part of...
Read more >
14 Useful Ways to Reuse an Old Router (Don't Throw It Away!)
Whatever the case, your old router or modem/router combi unit can be reused. We've identified 14 new uses for old routers: Wireless repeater. ......
Read more >
Clojure Guides: java.jdbc - How to reuse database connections
Since you rarely want every database operation to create a new connection, there are two ways to reuse connections: Grouping Operations using ......
Read more >
Performance degradation when reusing DSLContext in jooq
//Method call try (Connection c = dataSource.getConnection()) { DSLContext dsl = DSL.using(c); return ...
Read more >
10.3.5. Establishing a DSL Connection Red Hat Enterprise ...
You can configure a new DSL connection by opening the Network Connections window, clicking the Add button and selecting DSL from the Hardware...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found