Comments (3)
Tagging @millerdev , per @czue's recommendation.
from django-cte.
@MisterNando this is a strange error. I'm unable to tell from the given traceback how as_sql()
is being called with extra arguments. Can you find out what code is calling as_sql()
when the error occurs?
If you cannot do that, can you find out what the values of args
and kwargs
are when the error occurs? Maybe temporarily add a print statement to the method and capture the output:
class CTEUpdateQueryCompiler(SQLUpdateCompiler):
def as_sql(self, *args, **kwargs):
print(args, kwargs) # <---- capture the output of this when the error occurs
def _as_sql():
return super(CTEUpdateQueryCompiler, self).as_sql(*args, **kwargs)
return CTECompiler.generate_sql(self.connection, self.query, _as_sql)
from django-cte.
Thanks for responding, @millerdev ! I can no longer reproduce the conditions that resulted in the error; however, I was able to dig up a more detailed stacktrace from our log archives:
[07/Sep/2018 09:00:00]::ERROR::api.py:34::as_sql() takes exactly 1 argument (3 given)
File "./asset_api/api/asset_checkin/api.py", line 27, in post
handler.resend_jobs_on_agent_request()
File "./asset_api/api/asset_checkin/utils.py", line 95, in resend_jobs_on_agent_request
).update(outcome_id=Globals.Outcome.Errored)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 647, in update
rows = query.get_compiler(self.db).execute_sql(CURSOR)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 1199, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 871, in execute_sql
sql, params = self.as_sql()
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 113, in as_sql
return CTECompiler.generate_sql(self.connection, self.query, _as_sql)
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 80, in generate_sql
base_sql, base_params = as_sql()
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 112, in _as_sql
return super(CTEUpdateQueryCompiler, self).as_sql(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 1187, in as_sql
where, params = self.compile(self.query.where)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 373, in compile
sql, params = node.as_sql(self, self.connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/where.py", line 79, in as_sql
sql, params = compiler.compile(child)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 373, in compile
sql, params = node.as_sql(self, self.connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/lookups.py", line 381, in as_sql
return super(In, self).as_sql(compiler, connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/lookups.py", line 170, in as_sql
rhs_sql, rhs_params = self.process_rhs(compiler, connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/lookups.py", line 372, in process_rhs
return super(In, self).process_rhs(compiler, connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/lookups.py", line 229, in process_rhs
return super(FieldGetDbPrepValueIterableMixin, self).process_rhs(compiler, connection)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/lookups.py", line 100, in process_rhs
sql, params = compiler.compile(value)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 373, in compile
sql, params = node.as_sql(self, self.connection)
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 113, in as_sql
return CTECompiler.generate_sql(self.connection, self.query, _as_sql)
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 80, in generate_sql
base_sql, base_params = as_sql()
File "/usr/local/lib/python2.7/dist-packages/django_cte/query.py", line 112, in _as_sql
return super(CTEUpdateQueryCompiler, self).as_sql(*args, **kwargs)
TypeError: as_sql() takes exactly 1 argument (3 given)
It looks like the Django SQLCompiler is calling as_sql() with itself and the DB connection as arguments (line 373 in compiler.py).
Does this provide you with the information that you need to proceed with your debugging?
from django-cte.
Related Issues (20)
- Mutiple CTEs Possible? HOT 2
- Muliples With joins HOT 3
- Allow non-recursive CTEs to avoid optimization fence HOT 1
- Support UNION queries that share a CTE HOT 2
- Cannot install via pipenv HOT 1
- no such table: cte while importing fixtures HOT 4
- Support Django 4.0 HOT 2
- Improve documentation HOT 3
- is there a way to select from a cte without joining it with a model? HOT 5
- Usage in the context of time series HOT 1
- Combining with django-reversion HOT 2
- Can I count all children in Queryset annotate? HOT 7
- annotate() usage in recursion HOT 5
- Unneccessary outer join breaks query HOT 1
- With(empty_qs) throws Error HOT 1
- “no such column”/“column does not exist” errors in Django 4.2 HOT 9
- Not able to do full outer join with django_cte HOT 2
- hnej
- `.update()` does not work when accessing nested tables HOT 1
- Minor : typo in the doc
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 django-cte.