Skip to content
Advertisement

How create Postgres database using SQLAlchemy

I want write project using database library (SQLAlchemy). When I use SQLite, all works good, but when I deploy project on server (Heroku with Postgres plugin), It doesn’t work. This is code for my database: I have engine & Base variable: In DATABASE_URL link to base on Heroku(Postgres). For create database I write in Interactive Python Console: After these manipulations

SQL – Selecting rows based on date difference

Suppose we have below table: Code Dt c1 2020-10-01 c1 2020-10-05 c1 2020-10-09 c1 2020-10-10 c1 2020-10-20 c2 2020-10-07 c2 2020-10-09 c2 2020-10-15 c2 2020-10-16 c2 2020-10-20 c2 2020-10-24 Combination of Code and Dt is unique. Rows are sorted based on Code and Dt. Database is Oracle 12. For every code, I want to get list of its Dts that

Trigger to update a table whenever there is an insert

I am trying to use a trigger (in SQL Server) to update a table whenever there is an insert on the table but I get an error: Conversion failed when converting date and/or time from character string. Trigger used: The table table_scan is to be updated when there is NULL in start_date after an insert happens. Answer Use IS NULL

Processing mulitple similar rows in Pandas

I have a dataframe pulled from a relational database. A one-to-many join has resulted in many similar rows with one column different. I would like to combine the similar rows but have the differing column data contained within a list, for each unique row. I am also able to change the SQL but I think this may be easier to

Advertisement