I am writing a django website that has some reports that pulls data based on DB2 database. Since I have only read only access to that database, I want the data from DB2 to be continuosly appended (or …
Tag: python
Python inserts only One row on a SQLite DB
Why my code only inserts one line? thewholeenchilada = (“SELECT SUBSTR(email, (SELECT INSTR(email,’@’))) AS org, SUM(count) as count FROM Em GROUP BY org ORDER BY count DESC”) for salida in cur….
Find Duplicates on Multiple Criteria
I have a set of financial transactions with a Date, Amount, Description and Source and I want to find transactions where the amount is the same, the date is within one day, but the sources are …
How to show the summation in each row of a measure with some conditions? [closed]
Let’s suppose that I have the following data: CustomerID->Number->Date 1->2->1/1/2019, 1->3->2/1/2019, 2->1->1/1/2019, 2->6->2/1/2019 I want to have a column let’s …
SQLAlchemy – Return filtered table AND corresponding foreign table values
I have the following SQLAlchemy mapped classes: class ShowModel(db.Model): __tablename__ = ‘shows’ id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100)) …
Converting HEX string into int [closed]
I need help on converting the varbinary data which I acquired from sql, into int by taking 4 bits at a time. From the code above, I acquired the results as (‘0x640761075D075A0…..’). My plan is to …
Add column moving average in mysql
I am currently adding crypto market data to my mysql database. I have the following data per minute : I would like to add the simple moving average of different time periods to the mysql database. I tried to do this calculation in python but this took to much time. Therefore, I calculated the SMA of a 50 day time
Column X which is neither GROUPED nor AGGREGATED – StandardSQL / BigQuery
I’ve been reading posts about this and the so many suggested solutions didn’t work as I want. I’m trying to get the sum of some columns for the same rows then selecting all the other columns when …
How to implement SQL Row_number in Python Pandas?
I am trying to number my dataframe records using SQL “Row_number over” function available in SQL but it results in error as shown in the image. Please note that I don’t wish to number records using Pandas function. Here is the code output of df1.head statement Once I execute this statement it throws an error This code is from Python
Spark SQL Partition By, Window, Order By, Count
Say I have a dataframe containing magazine subscription information: subscription_id user_id created_at expiration_date 12384 1 2018-08-10 2018-12-10 …