I am writing a python regex that matches only string that consists of letters, digits and one or more question marks. For example, regex1: ^[A-Za-z0-9?]+$ returns strings with or without ? I want a regex2 that matches expressions such as ABC123?A, 1AB?CA?, ?2ABCD, ???, 123? but not ABC123, ABC.?1D1, ABC(a)?1d on mysql, I did that and it works: Answer How
Tag: mysql
Dropdown list issues
I’ve also been trying to set a default value in a dropdown box on HTML from the data I retrieved from MySQL. However, I noticed that if the user did not click on the dropdown box and clicked on one item from it. In other words, if they assumed the displayed value is the value they would like to submit
How to put date(parsed from csv) in Python to mysql?
I’ve made separate simple example just to check what method would work with date in my case and didn’t find any solution. we have: db table: code CSV file example_v2.csv: Trace Could you please assist in even find the documentation fit my case or indicate the direction. I’ve already tried a lot of methods such as: etc. Answer thanks to
POST on MYSQL database done in terminal but nothing in my base
I would like to know why all seems to be okay but nothing is insert in my mysql database ? I get some data from an api and I would like to insert data in table. Using flask, python, pymysql Thanks in advance traceback Answer Assuming that the INSERT statement looked good at that debugging print function, then you probably
How to convert a bytearray in a tuple in a list to a string?
I am trying to fetch data from my mysql database using python: This reads a column in my database called binaryValue, where every row is either a “0” or a “1” When I print out the variable “myresult”, it gives me a list where each item is a tuple: I need to get a string with either “0” or “1”
How to convert a full number to 2 decimal places in python and mysql?
So I have a whole number such as 45125 and want to convert to 451.25, or 54200 to 542.00. I want to be able to convert using both python and sql. Is there a way of doing it? I already tried researching but couldn’t find a solution. Answer In python, In SQL,
Why is my code for sqlalchemy query getting an error while raw mysql isn’t?
I am having issues using SQLAlchemy. When executing below code I get an error (1066, “Not unique table/alias: ‘user_role'”). If I am to execute the query myself in mysql-console taken from the sqlalchmey query-string I get no such error. What could make sqlachemy make it so that it throws an error such as this? UserRole is table user_role. Raw mysql:
Flask-SQLAlchemy: ‘Table’ object has no attribute ‘query_by’
I’m developing an API with Flask and I cannot retrieve queries from a MySQL database I’ve connected with flask-sqlalchemy (not sqlalchemy alone). This is a pre-existing database downloaded from my client’s PHPMyAdmin, so I haven’t ran db.create_all(): I simply created the connection string in config.py, then instantiated db = SQLAchemy() and initialized it (db.init_app(app)) in my factory function (i’m using
I am trying to make a SQL query of Update in python but it is giving error
Error :- mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘:00 WHERE Contact_no = 9827355876’ at line 1 How can I do this to make a single query of SQL ? Answer You should be using a prepared statement here,
MySQL Query Passing Two Variables Python SQLConnector
I can’t seem to get two values passed on a query, I can get one variable to pass no problem, can’t figure out what I’m doing wrong, error posted when I try to use the two variable code, one variable code passes. One Variable: Two Variable: Error: Updated code after answer: Error: I am not sure I still get this