How do I escape the % from a mysql query in python.
For example
query = """SELECT DATE_FORMAT(date_time,'%Y-%m') AS dd
FROM some_table
WHERE some_col = %s
AND other_col = %s;"""
cur.execute(query, (pram1, pram2))
gives me a "ValueError: unsupported format character 'Y'" exception.
How do I get mysqldb to ignore the %? Can't see thi...
hey folks, I'm setting up a keyword search across multiple fields: name_first, name_middle, name_last but I'm not getting the results I'd like. Here's the query:
"SELECT accounts_users.user_ID, users.name_first, users.name_middle, users.name_last, users.company
FROM accounts_users, users
WHERE accounts_users.account_ID = '$acc...
I'm having an issue with this query...
SELECT account_id FROM `clock`
WHERE account_id = '.$accountId.' AND `clock`.`in` > 0 AND `clock`.`out` == 0
The only thing I can think of is that in/out are keywords.... but with backticks it should work fine.... right?
...
Hi at all, is my first question here, so be patient ^^
I'll go directly to problem,
I have two table
Customer (idCustomer, ecc.. ecc..)
Comment (idCustomer, idComment, ecc.. ecc..)
obviosly the two table are joined togheter, for example
SELECT * FROM Comment AS co
JOIN Customer AS cu ON cu.idCustomer = co.idCustomer
With this I se...
I've inherited a rather large and somewhat messy codebase, and have been tasked with making it faster, less noodly and generally better.
Currently we use one big database to hold all data for all aspects of the site. As we need to plan for significant growth in the future, I'm considering splitting tables relevant to specific sections o...
I am going to be extending the column from VARCHAR(350) to VARCHAR(800) - will affect any of the strings that are inside the column already?
...
I work for a very small company. I was recently faced with the question of whether there is a good way to convert a proprietary database to a MySQL database without owning the proprietary database engine e.g. if one is given a large oracle database file (or choose your favorite proprietary database engine format), but doesn't have a lice...
I'm working with PreparedStatement with MySQL server.
example:
String myQuery = "select id from user where name = ?";
PreparedStatement stmt = sqlConnection.prepareStatement(myQuery);
stmt.setString(1, "test");
stmt.executeQUery();
ResultSet rs = stmt.getResultSet();
How can I receive the full SQL query that is about to be executed ...
I'm trying to create a more succinct way to make hundreds of db calls. Instead of writing the whole query out every time I wanted to output a single field, I tried to port the code into a class that did all the query work. This is the class I have so far:
class Listing {
/* Connect to the database */
private $mysql;
function __constr...
I need to change the way I am storing information in the DB. Because the query works slow with the old model I had developed.
General problem is following.
1) I have list of courses, and each course has list of tags describing general content of the course. For instance, the course called "Database Management Systems" could have follow...
Using:
UPDATE `play`
SET `counter1` = `counter1` + LEAST(`maxchange`, FLOOR(`x` / `y`) ),
`counter2` = `counter2` - LEAST(`maxchange`, FLOOR(`x` / `y`) ),
`x` = MOD(`x`, `y`)
WHERE `x` > `y`
AND `maxchange` > 0
As you can see, LEAST(maxchange, FLOOR(x / y) ) is used multiple times, but it should always have th...
I am using InnoDB for a MySQL table, and obviously queries using LIKE and RLIKE/REGEXP can take a lot of time.
I've tried Spinx, and it works great, except I have to re-index context at intervals. I can re-index every minute, but I am wondering if there is either 1) a setting in Sphinx to keep records always indexed or 2) other software...
For every Card, I would like to attach a special number to them that increments by one.
I assume I can do this all in the controller.
def create
@card = Card.new(params[:card])
@card.SpecNum = @card.SpecNum ++
...
end
Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem i...
Hello, I have a table with OWN_ID and OWN_Email -
own_id | own_email
-----------------------------------------------
3ace7cf80edd | [email protected]
3acf6af33ff7 | [email protected]
3acda2524e00 | [email protected]
3ad75583c9a7 | [email protected]
3ad74b018999 | [email protected]
etc.
the problem is th...
trying to parse "06/01/2010 15:00:00 08:00"
the problem is the last offset hour, mysql str_to_date can't parse it, any idea?
...
where can I find the mysql logs (errors, queries, etc) in the phpmyadmin interface?
...
Hi,
I have the following MySQL tables:
TABLE: Products
----------------------
id | productname
1030 | xBox 360
1031 | PlayStation 3
1032 | iPod Touche
TABLE: Sales
----------------------
productid | saledate
1031 | 2010-06-14 06:30:12
1031 | 2010-06-14 08:54:38
1030 | 2010-06-14 08:58:10
1032 | 20...
How would you temporarily store several thousands of key => value or key => array pairs within a single process. Lookups on key will be done continuously within the process, and the data is discarded when the process ends.
Should i use arrays? temporary MySQL tables? Or something in between?
...
In an app I am working on, we use a MySQL database and want to store articles in a table. Rather than store them in a SQL DB, we were looking at just storing the key to the article in a NoSQL db. Is this a good problem to solve using NoSQL, or should we just create another table in MySQL and store the large amounts of text there?
We a...
If I wanted to save a contact form submission to the database, how can I insert the form scope in as the submission? It's been some time since I used Coldfusion.
The contact forms vary depending on what part of the site it was submitted from, so it needs to scale and handle a form with 5 fields or one with 10 fields. I just want to stor...