sql

SQL Query in python file shows up as "COLUMNS" instead of "VALUES"

SQL Query in python file shows up as "COLUMNS" instead of "VALUES" Question: I am very new at this, and im trying my best but i simply cant see where im f…ing up =( I have made an SQL Query in my python file. I want to write to my Azure database table –> make …

Total answers: 1

How to pass parameter to raw sql in Django

How to pass parameter to raw sql in Django Question: I am trying to create a simple ledger using raw SQL query in Django through my view.py. If I add my parameter value direct I get my required results but if I follow the tutorial here I get the error message below. ERROR MESSAGE ProgrammingError …

Total answers: 1

Trying to convert psycopg2 -> Python data from list tuples to dict

Trying to convert psycopg2 -> Python data from list tuples to dict Question: I have a postgreSQL table called stockdata with financial statement information for about 250 companies with the following setup: Company q4_2022_revenue q3_2022_revenue CPI Card 126436000 124577000 Zuora 103041000 101072000 … I used the psycopg2 package in Python to import this data into …

Total answers: 2

SQLite: how to concatenate JOIN

SQLite: how to concatenate JOIN Question: I have three tables in my database, related to physical exercises: exercises(id, name) tags(id, name) exercises_tags(id_exercise, id_tag) The exercises_tags table stores which tags corresponds to which exercise. One exercise can have multiple tags. Example: exercises(id, name): (1, ‘squat’) tags(id, name) (1, ‘legs’) (2, ‘quads’) (3, triceps) exercises_tags(id_exercise, id_tag) (1, …

Total answers: 1

How to omit certain parts of a SQL query

How to omit certain parts of a SQL query Question: Disclaimer that I’m highly aware there’s a better way to word the question, if someone wants to suggest a better way I’d be happy to change it I’ve been working with DynamoDB for the past 4 years and now I’m switching one of my tables …

Total answers: 1

DESCRIBE TABLE Equivalent for Apache Ignite

DESCRIBE TABLE Equivalent for Apache Ignite Question: I am looking to get the column names and the data types for my Apache Ignite tables. Is there a SQL query that can be used to accomplish this? Maybe an equivalent to the DESCRIBE TABLE command? If this is not possible using SQL, can it be done …

Total answers: 1

How to Insert in SQL using django app but getting COUNT field incorrect or syntax error

How to Insert in SQL using django app but getting COUNT field incorrect or syntax error Question: I want to insert data from django to SQL but getting error : (‘07002’, ‘[07002] [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error (0) (SQLExecDirectW)’) My code is below: for connection: def connsql(): server = ” database …

Total answers: 1

Attempting to do detail validation on a db created in sqlite 3 using python

Attempting to do detail validation on a db created in sqlite 3 using python Question: I’m transitioning from keeping and checking login files on a text document to from a SQL database. In my current solution, I have got it working where I can check the file for the username and password and then report …

Total answers: 1

Error with insert value in SQLite3 with python 2.7 script

Error with insert value in SQLite3 with python 2.7 script Question: I made a script to insert values taken from a json into a database. The script works but if it encounters an EMPTY value (example: "") then it returns error without inserting anything. How can I avoid this error? Here is the script connection …

Total answers: 1

How can I have a row-wise rank in a pyspark dataframe

How can I have a row-wise rank in a pyspark dataframe Question: I have a dataset for which I am going to find the rank per row. This is a toy example in pandas. import pandas as pd df = pd.DataFrame({"ID":[1,2,3,4], "a":[2,7,9,10], "b":[6,7,4,2], "c":[3,4,8,5]}) print(df) # ID a b c # 0 1 2 6 …

Total answers: 1