python and MySQL - 3 questions

E

el chupacabra

I'm using mysqldb module and python 2.4. I'm a newbie. Thanks in advance.

1. Output desired:

"hello"
"world"

I know that MySQL takes \n and \t and what not.

But my python script, it takes that \n as literal. Meaning, when I retrieve the records, they show up like "hello \n world".

How can keep formatting when inserting data to table?

This is what I have:

cursor.execute('insert into table values (%s, %s, %s, %s)', (newId, insertEntryName, insertLastName, insertSSN)


2. How can make my python show *** (stars) when entering user passwords?

3. Is it possible to make Python/MySQL transactions secure, encrypted? Can you point me to readings or something?



--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
D

Dennis Lee Bieber

<<< cue theme from "The Prisoner" >>>
"Information.... We want... Information..."

I'm using mysqldb module and python 2.4. I'm a newbie. Thanks in advance.

1. Output desired:

"hello"
"world"

I know that MySQL takes \n and \t and what not.

Show us the exact input...

print repr(instuff)

Then show us the exact output...

print repr(outstuff)
Dennis Lee
Bieber Dennis Lee
Bieber

Sure look the same to me...

2. How can make my python show *** (stars) when entering user passwords?

Command line console, Tkinter, Win32 native, wxPython, GTK? They all
have different ways...

However, as a start... open the Python help system and look for
password... You should find:

"""
6.13 getpass -- Portable password input

The getpass module provides two functions:

getpass( [prompt])
Prompt the user for a password without echoing. The user is prompted
using the string prompt, which defaults to 'Password: '. Availability:
Macintosh, Unix, Windows.

getuser( )
Return the ``login name'' of the user. Availability: Unix, Windows.
This function checks the environment variables LOGNAME, USER, LNAME and
USERNAME, in order, and returns the value of the first one which is set
to a non-empty string. If none are set, the login name from the password
database is returned on systems which support the pwd module, otherwise,
an exception is raised.
"""
3. Is it possible to make Python/MySQL transactions secure, encrypted? Can you point me to readings or something?

SSH?

The MySQL reference manual?

Page 141/142 of the Black/Brown MySQL/O'Reilly manual has a chapter
on using SSH on Windows for a secure connection.

I'd expect the newer MySQL press manuals have the same chapter.
--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top