All Questions
Tagged with insert-update python
40
questions
2
votes
1
answer
584
views
Django REST PATCH request field is required problem
I have a Student model. And I want to update some specific fields. But when I go to update one or two fields but the other field value is as it is then which fields are not changing those fields show ...
1
vote
2
answers
850
views
Python-Pandas -How to update multiple row values with a condition on unique column
I have a main dataframe for which few row values are missing for a candidate. And i have an excel file for which few of these missing values are present in this excel file. So i am trying to update ...
0
votes
0
answers
86
views
How to only update the data that has changed in QTableView (Python)
So basically this is my PandasModel:
class pandasModel(QAbstractTableModel):
def __init__(self, data, editable=False):
QAbstractTableModel.__init__(self)
self._data = data
...
0
votes
1
answer
61
views
How to improve this INSERT code with ON DUPLICATE KEY UPDATE
I had this code:
for chunk in np.array_split(DataFrame, 20, axis=0):
for i in chunk.index:
cursor.execute("INSERT INTO table (col1, col2, col3, col4) VALUES (%s, %s, %s, %s) ON ...
1
vote
2
answers
58
views
Should primary key columns be added in the UPDATE?
In the example code below, col1 and col2 are primary keys in the database!
My question is: should they be added in the part of the code after the ON DUPLICATE KEY UPDATE, as it is already in the code, ...
0
votes
0
answers
803
views
How to do an UPSERT in Python for MSSQL [duplicate]
I have the following problem. I am getting some data from an api in form of a json.
I want to load this json data into an existing table.
I get the data in following format:
{
"abcd": &...
3
votes
1
answer
395
views
How to create insert query with multiple values in python for postgresql
I have datas in df like
time
location
information
2.13
India
Good
2.34
USA
Good
I need to update this to timescale db where time is the unique key, i have used
list_db_df=df.values.tolist()
...
2
votes
1
answer
138
views
Python Pandas dataframes merge update
My problem is kind of a bit tricky (similar to sql merge/update), and not understanding how to fix: ( I am giving a small sample of the dataframes below)
I have two dataframes :
dfOld
A B ...
0
votes
1
answer
1k
views
Periodically process and update documents in elasticsearch index
I need to come up with a strategy to process and update documents in an elasticsearch index periodically and efficiently. I do not have to look at documents that I processed before.
My setting is that ...
5
votes
0
answers
5k
views
How to use ListSerializer for create and update multiple records in django rest framework?
Here is the way to create and update multiple records at once in django rest framework using ListSerializer. This way is very sort and and give fast response.
When you want to create a objects then ...
1
vote
1
answer
357
views
Replace old records while inserting new duplicate records in Mongoose
The mongoDB collection:
db.collection.find()
{ _id:'...', emp: 'A', name: 'nameA', age: 23 }
{ _id:'...', emp: 'B', name: 'nameB', age: 54 }
{ _id:'...', emp: 'C', name: 'nameC', age: 45 }
The ...
0
votes
1
answer
283
views
Reading txt file in real time and update postgressql database using Python
I have a txt file with many rows what is updating in real time.
e.g. :
001;2021/11/16;08:00:12;IN;123456789;123456;John Doe
001;2021/11/16;09:00:18;OUT;987654321;654321;Jane Doe
And I have a postgrest ...
0
votes
1
answer
948
views
how to update(calculate) a specific field if the object exists django
i made a project for a store , and i want to prevent from duplicate products , if the product doesnt exists then insert it into the database , but otherwise if it doesn't then just update field(...
0
votes
2
answers
108
views
Concatenate 2 dataframes (update) aggregating by sum
I have 2 dataframes, df1 and df2. Dataframe df2 must be concatenated with df1 with values in column 'bricks' which are not in df1 and if column value exists then update the volume data by adding the ...
0
votes
1
answer
1k
views
How to update python x.x to python x.x keeping all the packages?
I am a python 3.8 user. So, to stay updated I want to update my python 3.8 to 3.9. But I have a huge number of packages installed in python 3.8. Is there any method to keep the packages and update ...