I have created a connection using redshift-connector and I’m finding a number of possible issues. All I’m trying to do is setup a (reliable) function within my library that will create the cursor and execute the passed sql statement with autocommit enabled, we need to support at a minimum delete from and select from. Connection ..
I have the following data: id | name | some_value | active ——————————– 1 | test | 1234 | false 2 | toast | qwert | false 3 | test | 4321 | true 4 | toast | trewq | false I want to get a list where each name is "unique". Additionally I want ..
I am trying to learn sqlalchemy and I have mostly copypasted code I’ve found on stack overflow. I need to get this script to work. There is an issue with genres with I can’t figure out. from sqlalchemy import exc, orm from datetime import datetime from flask import Flask from flask_sqlalchemy import SQLAlchemy import pandas ..
i have objects from db and delete button. How to mark buttons to delete them correctly by id or something. My code doesn’t work, it delete only the last one. I use sqlalchemy with sqlite for db. def show_coaches(): col=0 row=0 for i in search_coach(): #returns arr objects e = tk.Label(frame_bottom, text=i.name, relief=tk.GROOVE) e.grid(row=row, column=col,padx=5, ..
I use Flask SqlAlchemy extension to access a SQL Server database for developing our API. The database has some columns are encrypted. To be able to decrypt these encrypted columns, I need to run the following statement before select/insert/update statements: OPEN SYMMETRIC KEY SymKey_MyApp DECRYPTION BY CERTIFICATE Certificate_MyApp Also I need to run the following ..
I’m trying the new sqlalchemy 1.4 select() syntax, but when executing this simple query, the result dict misses the column ‘graph’, but the result list includes it. import sqlalchemy as sa from source.Models import Quadrant, Graph engine = sa.create_engine("postgresql://blahblahblah") dbsession = sa.orm.Session(engine) stmt = sa.select( Quadrant.id, sa.text("array_agg(graph.data order by graph.id) as graphs") ).outerjoin( Graph, Quadrant.id ..
i am using sqlalchemy as my orm with flask and database as postgres(psycopg2).. i am observing that few times, random queries are taking approx 15 min not even anywhere between one and 14 ..it is always approx 15. I have got this data using classic time.time() difference before and after query and it perfectly matches ..
I’m new to coding. I have the code below: class Movie(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(250), unique=True, nullable=False) year = db.Column(db.Integer, nullable=False) description = db.Column(db.String(500), nullable=False) rating = db.Column(db.Float, nullable=True) ranking = db.Column(db.Integer, nullable=True) review = db.Column(db.String(250), nullable=True) img_url = db.Column(db.String(250), nullable=False) db.create_all() When I’m running the code I’m getting this error: Traceback ..
i try to filter my entity by column named valid and for this i apply simple filter below session.query(Mymodel).filter(Mymodel.valid !=True) The problem is that i have None, False, and True statement for valid field. How can i do correct filter to return False and None also? Source: Python..
Apologies for what may be confusing question so i have two separate problems one is the transposed() dataframe is resulting in redundant rows as shown in the code and i would like to get rid of these… & the second is that the error is showing up with "Data too long for column ‘Main Image ..