Skip to content
Advertisement

Tag: python

aiosqlite “Result” object has no attribue “execute”

I’m making a discord.py bot and I’m currently on the economy part, but I’m encountering a strange error that I’ve never ran into before and has most of the python discord help dumbfounded. The error is as follows: Command raised an exception: AttributeError: ‘Result’ has no attribute ‘execute’ I’m having trouble understanding the meaning of this error due to the

How to compose Django Model Filter for relation existence?

There is a many-to-many relationship between A and B. There are 3 tables to represent that relationship. TableA, TableB, TableAB Now I have another table TableC where it has a foreign key to TableA, and I want to filter objects from TableC where it has a relationship with TableB. The following is high-level code to give you the idea how

Create hierarchical summary of XML nodes

Is there a way of using SQL or Python (or another language) to return the node-tree for an XML document? In the XML document example below, the employee node appears twice but the second time it has more nodes within it… same with the address node. Is there a way to return the structure (without values contained within the tags)

How to use Peewee to make CASE SQL queries?

I have a table in postgres that holds a priority integer for each row. The priority needs to update whenever I add a new row or change the priority of an existing one for all of the other rows in the table. One way to do it in pure SQL would be with a CASE query: Question: How can I

how do i increment a value of column with condition?

my table looks something like this i have a function, which return 1to3 int value representing effect1,effect2,effect3 and “id” i am trying to increment value of each effect by 1 when my function’s returning “id” matches the “id” from my dataset otherwise creates new row and increase value of effect for example if my function returns (1,3) my table will

django ‘dict’ object has no attribute ‘job_id’

I’ve got this code: Even though value() is defined, I get the error ‘dict’ object has no attribute ‘job_id’ I guess the error will also be for pass_count, skip_count and fail_count What am I supposed to do here? Answer Your query does not return a queryset with object instances, so you cannot refer to fields with a “.” It is

How to do query with multiple condition from 2 table?

I wanna pick cities from worldcity by these conditions: the population of the city exceeds the population of the most populous city in the Filipina. (Meaning: for example city X is the city in the Filipina with the most population. We want to list the cities with a population greater than city X), AND there is a city in the

postgres column allow space to column while making alias name

python code to make query from postgres table error: I wants to add space to alias name of column thats why i have written my code like this. Plese check how can i fix it. Answer Postgres follows the SQL standard and uses double quotes, not backticks, to escape database object names (such as column or table names). Use this

merging tables with different structures

I have two tables where I want to find the outer join based on a Ticker variable. In Table I, I have only one Ticker for each entity (fund), but in table II, I may have multiple records (multiple Ticker) for each “FundID”. The goal is to count the unique funds. I want to have table III, which is the

Advertisement