I’m having trouble using the combobox in an external file. Basically the combobox is in the main file and I would like to use its selected value in the external file. If I select a certain item, it should help cursor.excute to search for a database table, so cursor.execute(“SELECT x FROM Table1 WHERE element = ?”, (combo1,)) As you can
Tag: python-3.x
PYTHON SQLITE selecting multiple where conditions that may or may not exist
Working on some code that uses pysimplegui as the UI and SQlite for the data sorting. I’m using SQLite’s execute function to select data based on input from the user in the UI through variables. For example user wants to search for part name they input all or part of the name into the box, hit the search button which
Connect to SQL Server in Python with ReadOnly
I am trying to connect to the SQL server in python using pyodbc. I am unable to connect because my database is ReadOnly. I tried the solutions provided at other link: But, I am still getting the following error: ProgrammingError: (‘42000’, “[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]The target database (‘PRMOperationalDB’) is in an availability group and is currently accessible for
How to dynamically pass values to the Oracle bind variable using Python (Using cx_oracle module)
I need to get values a from client dynamically(using input function) and I need to pass that value to Oracle bind variable. I am using SQL queries. Answer Here’s an example: Running it gives:
In tkinter, how can I use a function in class A to populate a widget in class B?
Primary relevant code is in class EntryForm (around line 190) and class BookmarkAccess (around line 246) I am sharing the global user_id as a means of querying specific rows of data from the database, after the login is completed. My current workaround is to use a button on the final page, to populate the listbox (self.title.select) with the queries using
How do I get the data extracted from API to my database
I am currently working on a project to build a database on professor’s research paper database. This is my first time building a database(never had experience with MYSQL) and I am learning as I am doing it. I was able to use an api to get the data, for example: {“authorId”: “1773022”, “url”: “https://www.semanticscholar.org/author/1773022”, “papers”: [{“paperId”: “1253d2704580a74e776ae211602cfde71532c057”, “title”: “Nonlinear Schrodinger
Psycopg2 connection sql database to pandas dataframe
I am working on a project where I am using psycopg2 connection to fetch the data from the database like this, Now after getting the data from the table, I am running some extra operations to convert the data from cursor to pandas dataframe. I am looking for some library or some more robust way to convert the data to
Idempotent record creation: is it better to use a unique constraint or check for existence before inserting a record?
I’ve recently been wondering what’s generally the best approach for ensuring that the creation of database records is idempotent. The two approaches I can think of are: Checking whether a record already exists before executing an INSERT Using a unique constraint on the relevant columns to insure two records with the same values cannot exist This seems like an example
Getting value error for INT when posting DataFrame values to psycopg2
I’m trying to insert a data to postgresql from a dataframe like this But getting this error code My sql table was created like this Answer The error says what’s the problem – the program expects integer and you pass list of integers there. It’s because execute is used to insert single row and as second parameter you should have
Concatenate variable in Athena SQL query from Python Lambda function
I have a Python Lambda function that creates a SQL table in Athena. How do I properly concatenate variables in my query? When I set the LOCATION value, I receive the error response below. The function runs successfully if I hard code the LOCATION value. Error response: Lambda function: Thank you. Answer Have you tried to use Python’s format method?