Re: protect psycopg script from sql injection?

2014-06-26 Thread Peter Otten
celati Laurent wrote: I coded this following python script via psycopg; web_service_test.py http://python.6.x6.nabble.com/file/n5062113/web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? No, but you might find out yourself. When you remove

protect psycopg script from sql injection?

2014-06-25 Thread celati Laurent
Hello, I coded this following python script via psycopg; web_service_test.py http://python.6.x6.nabble.com/file/n5062113/web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? 2/ Could you tell me how to protect this script from SQL injections please

protect psycopg script from sql injection?

2014-06-25 Thread dandrigo
Hello, I coded this following python script via psycopg; web_service_test.py http://python.6.x6.nabble.com/file/n5062113/web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? 2/ Could you tell me how to protect this script from SQL injections please

Re: protect psycopg script from sql injection?

2014-06-25 Thread MRAB
On 2014-06-25 22:58, celati Laurent wrote: Hello, I coded this following python script via psycopg; web_service_test.py http://python.6.x6.nabble.com/file/n5062113/web_service_test.py 1/ When i execute it, the result is 'bad resquest'. Could you tell me why? 2/ Could you tell me how

Psycopg Documentation

2009-03-29 Thread taliesin
Hi, I'm probably being very dense so apologies in advance, but I can't find any decent documentation for the psycopg module for PostgreSQL interfacing. Google and Yahoo don't seem to return much for any of the queries I gave them and what's listed as the homepage for psycopg is this: http

Re: Psycopg Documentation

2009-03-29 Thread Diez B. Roggisch
taliesin schrieb: Hi, I'm probably being very dense so apologies in advance, but I can't find any decent documentation for the psycopg module for PostgreSQL interfacing. Google and Yahoo don't seem to return much for any of the queries I gave them and what's listed as the homepage for psycopg

Re: Psycopg Documentation

2009-03-29 Thread taliesin
Diez B. Roggisch wrote: taliesin schrieb: Hi, I'm probably being very dense so apologies in advance, but I can't find any decent documentation for the psycopg module for PostgreSQL interfacing. Google and Yahoo don't seem to return much for any of the queries I gave them and what's listed

Re: Psycopg Documentation

2009-03-29 Thread Albert Hopkins
On Sun, 2009-03-29 at 11:35 +0100, taliesin wrote: Hi, I'm probably being very dense so apologies in advance, but I can't find any decent documentation for the psycopg module for PostgreSQL interfacing. Google and Yahoo don't seem to return much for any of the queries I gave them

psycopg

2007-12-12 Thread sujitha mary
hi all, while executing this cur.execute('insert into seq(id,sequence) values(3,'+content+')') i'm getting an error psycopg2.ProgrammingError: syntax error at or near prophage LINE 1: insert into seq(id,sequence) values(3,Tum2 prophage complete... --

Re: psycopg

2007-12-12 Thread Calvin Spealman
Don't do that, for a number of reasons. String concatenation is really never a good idea and formatting your own query strings is exactly what leads to things like sql injection. Let the db library handle it for you: cur.execute('insert into seq(id,sequence) values(3, %s)', (content,))

Re: psycopg

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 09:08:44AM -0500, Calvin Spealman wrote regarding Re: psycopg: Don't do that, for a number of reasons. String concatenation is really never a good idea and formatting your own query strings is exactly what leads to things like sql injection. Let the db

Re: your opinion about psycopg vs pygresql

2006-12-21 Thread Maxim Sloyko
a clue how they differ and on what reason, why does PostgreSQL seem to favour pygresql and Pythoneers psycopg? Thanks in advance. Well, my info can be a little out of date, since I researched this problem more than a year ago. AFAIK, psycopg still lacks prepared statements, which can be a huge

your opinion about psycopg vs pygresql

2006-12-20 Thread Martin P. Hellwig
and by that time I've noticed that python projects like Django seem to favor the psycopg module. So I installed that one (the 1.1 version, since Django uses that too) and it looked like it has the same problem of creating a user after a database, I'm sure that there is a user error in there somewhere

Re: your opinion about psycopg vs pygresql

2006-12-20 Thread johnf
and started googling and by that time I've noticed that python projects like Django seem to favor the psycopg module. So I installed that one (the 1.1 version, since Django uses that too) and it looked like it has the same problem of creating a user after a database, I'm sure

psycopg: tz import error

2006-10-06 Thread km
Hi all,i have python 2.4.3 and 2.5 versions installed default python interpreter being 2.5have compiled psycopg2 with python2.4.3 setup.py.install , it installs in site-setup of 2.4.3 but when i login as a normal user and get into interctive python prompt of 2.4.3 , and import tz fails to

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Frank Millman
Michele Simionato wrote: Look at this example: import psycopg psycopg.__version__ '1.1.19' import datetime today = datetime.datetime.today() co = psycopg.connect('') cu = co.cursor() cu.execute('CREATE TABLE example (date date)') cu.execute(INSERT into example VALUES (%s

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Michele Simionato
Frank Millman: import datetime as dt def DbToDate(dat): if isinstance(dat,dt.datetime): return dat # already in datetime format if isinstance(dat,dt.date): return dt.datetime.combine(dat,dt.time(0)) # convert to datetime This is exactly the type checking I would like

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Frank Millman
This is exactly the type checking I would like to avoid :-/ Michele Simionato psycopg returns a datetime.datetime object from a TIMESTAMP column, and a datetime.date object from a DATE column. You should not have to do any type checking unless you are doing something odd, like I am, and wanting

Re: inserting/retriving dates in psycopg

2006-01-05 Thread Michele Simionato
Frank Millan: Perhaps if you explain what you are trying to do, I may be able to suggest something. I am looking for an adaptation/type cast mechanism and looking at the sources I think I have found it in doc/examples/usercast.py. I am doing some experiment now ... Michele Simionato --

inserting/retriving dates in psycopg

2006-01-04 Thread Michele Simionato
Look at this example: import psycopg psycopg.__version__ '1.1.19' import datetime today = datetime.datetime.today() co = psycopg.connect('') cu = co.cursor() cu.execute('CREATE TABLE example (date date)') cu.execute(INSERT into example VALUES (%s), (today,)) Traceback (most recent call

Re: Find out the schema with psycopg?

2005-12-24 Thread Steve Holden
Ben Hutchings wrote: Steve Holden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I am trying to discover the schema of a PostgreSQL database programatically at runtime. I'm using psycopg (I assume that's still the best library). Is there a way to query the schema other than opening

Re: Find out the schema with psycopg?

2005-12-23 Thread Ben Hutchings
Steve Holden [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I am trying to discover the schema of a PostgreSQL database programatically at runtime. I'm using psycopg (I assume that's still the best library). Is there a way to query the schema other than opening a system pipe like psql

Re: Find out the schema with psycopg?

2005-12-22 Thread Steve Holden
[EMAIL PROTECTED] wrote: I am trying to discover the schema of a PostgreSQL database programatically at runtime. I'm using psycopg (I assume that's still the best library). Is there a way to query the schema other than opening a system pipe like psql -d '\d', psql -d '\d tablename', etc

Find out the schema with psycopg?

2005-12-21 Thread survivalist
I am trying to discover the schema of a PostgreSQL database programatically at runtime. I'm using psycopg (I assume that's still the best library). Is there a way to query the schema other than opening a system pipe like psql -d '\d', psql -d '\d tablename', etc.? DBIAPI 2.0 shows

Intalling psycopg

2005-08-14 Thread ys
Hi I am getting ImportError: No module named psycopg i downloaded windows binary from http://stickpeople.com/projects/python/win-psycopg/ It is intalled in python24\lib\site-packages\psycopg2\ please help! Thanks YS -- http://mail.python.org/mailman/listinfo/python-list

psycopg simplest problem

2005-07-08 Thread Glauco
all time check for none, empty string and so on... I've seen API of psycopg and some procedure for the solution but all are too spaghetti for me. I'm only with this problem ? Glauco

Re: psycopg simplest problem

2005-07-08 Thread Gerhard Haering
. psycopg uses the pyformat one, where you just use %s as placeholders. It will happily quote all Python values of types int, str, date, float, etc. for you. It's also possible to teach it how to quote other custom data types, but you'll normally not need this. HTH, -- Gerhard -- Gerhard Häring

Re: psycopg simplest problem

2005-07-08 Thread Glauco
among the various DB-API modules. psycopg uses the pyformat one, where you just use %s as placeholders. It will happily quote all Python values of types int, str, date, float, etc. for you. It's also possible to teach it how to quote other custom data types, but you'll normally not need

Re: psycopg simplest problem

2005-07-08 Thread Gerhard Häring
Glauco wrote: [...] Gerhard thank you very much, this example explain me some idea, but anyway don't resolve the core question. In you example when dateVal is a None or textVal is none. argument x must be DateTime, not None. so i must manipulate for the empty string or None cases No, you

Re: psycopg authentication

2005-03-12 Thread Lee Harr
On 2005-03-12, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'm new to both PostgreSQL and psycopg and I'm trying to connect to my database running on localhost. I have postgres setup to do md5 authentication and this works when using a db admin tool on my local network. For some reason

Re: psycopg authentication

2005-03-12 Thread [EMAIL PROTECTED]
I did, the pg_hba conf is a big tricky to me. I've tried the following things.. the commented out lines I also tried. #localall ident sameuser localall md5 host all 127.0.0.1

Re: psycopg authentication

2005-03-12 Thread [EMAIL PROTECTED]
Thanks for the reply. I figured it out, the problem was with my postgresql configuration. the following seemed to do the trick. localall md5 host all 0.0.0.0 0.0.0.0 md5 -- http://mail.python.org/mailman/listinfo/python-list

Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Eino Mäkitalo
I had Visual C++ 6.0, so I compiled those libpq.dll and psycopg.pyd. if there are anyone to play with Windows, Python 2.3 and Postgre-8.0.0-beta4 for windows like me. You cat get those from: http://eino.net/html/python.html Original psycopg source code is available in: http://initd.org/projects