Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-11 Thread Jon Ribbens via Python-list
On 2024-09-11, Lawrence D'Oliveiro wrote: > On Tue, 10 Sep 2024 22:48:36 - (UTC), Jon Ribbens wrote: >> But what if you tell it the wrong thing ... > > To get back to the original point of this thread, all that rigmarole to > try to ensure to call “rollback” in case of an exception is complet

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Lawrence D'Oliveiro wrote: > On Tue, 10 Sep 2024 08:38:30 - (UTC), Jon Ribbens wrote: > >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> >>> On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote: On 2024-09-09, Lawrence D'Oliveiro wrote: > > On Mon, 9 Se

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-10, Karsten Hilbert wrote: > Am Tue, Sep 10, 2024 at 08:38:30AM - schrieb Jon Ribbens via Python-list: >> Ok. So we've moved away from "In any DBMS worth its salt, rollback is >> something that happens automatically" > > Nope. The original post asked something entirely different. N

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Karsten Hilbert via Python-list
Am Tue, Sep 10, 2024 at 08:38:30AM - schrieb Jon Ribbens via Python-list: > Ok. So we've moved away from "In any DBMS worth its salt, rollback is > something that happens automatically" Nope. The original post asked something entirely different. > and now you're saying it isn't automatic aft

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-10 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 21:12:51 - (UTC), Jon Ribbens wrote: >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote: On 2024-09-09, Lawrence D'Oliveiro wrote: > The database only needs to com

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 10:00:11 - (UTC), Jon Ribbens wrote: >> On 2024-09-09, Lawrence D'Oliveiro wrote: >>> The database only needs to commit when it is explicitly told. Anything >>> less -- no commit. >> >> So the Python code is half-way through a tr

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Karsten Hilbert wrote: > Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list: >> So the Python code is half-way through a transaction when it throws >> a (non-database-related) exception and that thread of execution is >> aborted. The database connection ret

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list: > So the Python code is half-way through a transaction when it throws > a (non-database-related) exception and that thread of execution is > aborted. The database connection returns to the pool, How does it return to th

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 10:00:11AM - schrieb Jon Ribbens via Python-list: > > The database only needs to commit when it is explicitly told. Anything > > less -- no commit. > > So the Python code is half-way through a transaction when it throws > a (non-database-related) exception and that thre

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-08, Lawrence D'Oliveiro wrote: > On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote: >> What if there's an exception in your exception handler? I'd put the >> rollback in the 'finally' handler, so it's always called. If you've >> already called 'commit' then the rollback does no

Re: psycopg2 positioning of .commit() (Posting On Python-List Prohibited)

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-09, Lawrence D'Oliveiro wrote: > On Mon, 9 Sep 2024 09:13:40 - (UTC), Jon Ribbens wrote: >> On 2024-09-08, Lawrence D'Oliveiro wrote: >>> On Sun, 8 Sep 2024 11:03:21 - (UTC), Jon Ribbens wrote: What if there's an exception in your exception handler? I'd put the rollba

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-09 Thread Jon Ribbens via Python-list
On 2024-09-08, Greg Ewing wrote: > On 8/09/24 9:20 am, Karsten Hilbert wrote: >> try: >> do something >> except: >> log something >> finally: >> .commit() >> >> cadence is fairly Pythonic and elegant in that it ensures the >> the .commit() wil

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 01:48:32PM +1200 schrieb Greg Ewing via Python-list: > That code doesn't inspire much confidence in me. It's far too > convoluted with too much micro-management of exceptions. It is catching two exceptions, re-raising both of them, except for re-raising one of them as anot

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-09 Thread Karsten Hilbert via Python-list
Am Mon, Sep 09, 2024 at 01:48:32PM +1200 schrieb Greg Ewing via Python-list: > That code doesn't inspire much confidence in me. It's far too > convoluted with too much micro-management of exceptions. > > I would much prefer to have just *one* place where exceptions are > caught and logged. I am o

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Greg Ewing via Python-list
On 9/09/24 2:13 am, Karsten Hilbert wrote: For what it's worth here's the current state of code: That code doesn't inspire much confidence in me. It's far too convoluted with too much micro-management of exceptions. I would much prefer to have just *one* place where exceptions are caught and l

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Greg Ewing via Python-list
On 8/09/24 11:03 pm, Jon Ribbens wrote: On 2024-09-08, Greg Ewing wrote: try: do something .commit() except: log something .rollback() What if there's an exception in your exception handler? I'd put the rollback in the 'finally' handler, so it's always called.

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Karsten Hilbert via Python-list
Am Sun, Sep 08, 2024 at 02:58:03PM +0100 schrieb Rob Cliffe via Python-list: > >Ugly: > > > > try: > > do something > > except: > > log something > > finally: > > try: > > .commit() > > except: > >

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Rob Cliffe via Python-list
On 07/09/2024 22:20, Karsten Hilbert via Python-list wrote: Am Sat, Sep 07, 2024 at 02:09:28PM -0700 schrieb Adrian Klaver: Right, and this was suggested elsewhere ;) And, yeah, the actual code is much more involved :-D I see that. The question is does the full code you show fail? The co

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Karsten Hilbert via Python-list
Am Sun, Sep 08, 2024 at 12:48:50PM +1200 schrieb Greg Ewing via Python-list: > On 8/09/24 9:20 am, Karsten Hilbert wrote: > > try: > > do something > > except: > > log something > > finally: > > .commit() > > > >cadence is fairly Pythonic and elegant

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-08 Thread Karsten Hilbert via Python-list
Am Sun, Sep 08, 2024 at 12:48:50PM +1200 schrieb Greg Ewing via Python-list: > On 8/09/24 9:20 am, Karsten Hilbert wrote: > > try: > > do something > > except: > > log something > > finally: > > .commit() > > > >cadence is fairly Pythonic and elegant

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Greg Ewing via Python-list
On 8/09/24 9:20 am, Karsten Hilbert wrote: try: do something except: log something finally: .commit() cadence is fairly Pythonic and elegant in that it ensures the the .commit() will always be reached regardless of exception

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Karsten Hilbert via Python-list
Am Sat, Sep 07, 2024 at 02:09:28PM -0700 schrieb Adrian Klaver: > >Right, and this was suggested elsewhere ;) > > > >And, yeah, the actual code is much more involved :-D > > > > I see that. > > The question is does the full code you show fail? > > The code sample you show in your original post is

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Karsten Hilbert via Python-list
Am Sat, Sep 07, 2024 at 01:03:34PM -0700 schrieb Adrian Klaver: > In the case you show you are doing commit() before the close() so any errors > in the > transactions will show up then. My first thought would be to wrap the > commit() in a > try/except and deal with error there. Right, and this

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Karsten Hilbert via Python-list
Am Sat, Sep 07, 2024 at 09:46:03AM -0700 schrieb Adrian Klaver: > >unto now I had been thinking this is a wise idiom (in code > >that needs not care whether it fails to do what it tries to > >do^1): > > > > conn = psycopg2.connection(...) > >

Re: psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Rob Cliffe via Python-list
On 07/09/2024 16:48, Karsten Hilbert via Python-list wrote: Dear all, unto now I had been thinking this is a wise idiom (in code that needs not care whether it fails to do what it tries to do^1): conn = psycopg2.connection(...) curs = conn.cursor() try

psycopg2: proper positioning of .commit() within try: except: blocks

2024-09-07 Thread Karsten Hilbert via Python-list
Dear all, unto now I had been thinking this is a wise idiom (in code that needs not care whether it fails to do what it tries to do^1): conn = psycopg2.connection(...) curs = conn.cursor() try: curs.execute(SOME_SQL) except PSYCOPG2-Exception

Re: Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread Peter J. Holzer via Python-list
On 2023-10-02 19:44:12 +0300, אורי via Python-list wrote: > I have an issue since about 5 months now. Python 3.12.0 venv not working > with psycopg2 on Windows. I created 2 issues on GitHub but they were > closed. I checked today with the new Python release but it's still not > wo

Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread אורי via Python-list
Hi, I have an issue since about 5 months now. Python 3.12.0 venv not working with psycopg2 on Windows. I created 2 issues on GitHub but they were closed. I checked today with the new Python release but it's still not working. https://github.com/psycopg/psycopg2/issues/1578 https://githu

Re: PSYCOPG2

2021-02-13 Thread Mladen Gogala via Python-list
I don't have PSYCOPG2 on my system, but try doing the following from python: [mgogala@umajor ~]$ python3 Python 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux Type "help", "copyright", "credits" or "license&quo

RE: PSYCOPG2

2021-02-13 Thread Tony Ogilvie
Subject: Re: PSYCOPG2 On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: > I am trying to write a program to open a PostgesSQL 13 database using > psycopg2. All seems to work if I write direct to Python but if I write > the script into IDLE it does not work with the IDLE Shell 3.9.1 &g

Re: PSYCOPG2

2021-02-13 Thread dn via Python-list
On 13/02/2021 18.34, Mladen Gogala via Python-list wrote: > On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: > >> I am trying to write a program to open a PostgesSQL 13 database using >> psycopg2. All seems to work if I write direct to Python but if I write >> the

Re: PSYCOPG2

2021-02-13 Thread Sibylle Koczian
Am 13.02.2021 um 06:34 schrieb Mladen Gogala via Python-list: On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: I am trying to write a program to open a PostgesSQL 13 database using psycopg2. All seems to work if I write direct to Python but if I write the script into IDLE it does not

Re: PSYCOPG2

2021-02-12 Thread Mladen Gogala via Python-list
On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: > I am trying to write a program to open a PostgesSQL 13 database using > psycopg2. All seems to work if I write direct to Python but if I write > the script into IDLE it does not work with the IDLE Shell 3.9.1 > reporting an

PSYCOPG2

2021-02-12 Thread Tony Ogilvie
I am trying to write a program to open a PostgesSQL 13 database using psycopg2. All seems to work if I write direct to Python but if I write the script into IDLE it does not work with the IDLE Shell 3.9.1 reporting an error of no attribute 'connect'. I have tried many options to t

Re: psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread Karsten Hilbert
On Fri, Oct 27, 2017 at 08:35:20AM -0700, maheshyadav1...@gmail.com wrote: > I am using 'psycopg2' library to access my PostgreSQL database from a python. > I want to pass a variable input in psql query something like this :- > > psql>>\set my_user table1 > psq

psycopg2.ProgrammingError: syntax error at or near "\"

2017-10-27 Thread maheshyadav1771
Hello, I am using 'psycopg2' library to access my PostgreSQL database from a python. I want to pass a variable input in psql query something like this :- psql>>\set my_user table1 psql>>select * from :my_user limit 10; So I am just running these sql commands

Re: Psycopg2 pool clarification

2017-06-10 Thread israel
On 2017-06-08 19:55, Ian Kelly wrote: On Thu, Jun 8, 2017 at 10:47 AM, Israel Brewster wrote: On Jun 7, 2017, at 10:31 PM, dieter wrote: israel writes: On 2017-06-06 22:53, dieter wrote: ... As such, using psycopg2's pool is essentially worthless for me (plenty of use for it, i&#

Re: Psycopg2 pool clarification

2017-06-08 Thread Ian Kelly
On Thu, Jun 8, 2017 at 10:47 AM, Israel Brewster wrote: >> On Jun 7, 2017, at 10:31 PM, dieter wrote: >> >> israel writes: >>> On 2017-06-06 22:53, dieter wrote: >>> ... >>> As such, using psycopg2's pool is essentially >>> worthless

Re: Psycopg2 pool clarification

2017-06-08 Thread Israel Brewster
n 2017-06-06 22:53, dieter wrote: >> ... >> As such, using psycopg2's pool is essentially >> worthless for me (plenty of use for it, i'm sure, just not for me/my >> use case). > > Could you not simply adjust the value for the "min" parameter? > If

Re: Psycopg2 pool clarification

2017-06-07 Thread dieter
israel writes: > On 2017-06-06 22:53, dieter wrote: > ... > As such, using psycopg2's pool is essentially > worthless for me (plenty of use for it, i'm sure, just not for me/my > use case). Could you not simply adjust the value for the "min" parameter? If you

Re: Psycopg2 pool clarification

2017-06-07 Thread israel
On 2017-06-06 22:53, dieter wrote: israel writes: Since I've gotten no replies to this, I was wondering if someone could at least confirm which behavior (my expected or my observed) is *supposed* to be the correct? Should a psycopg2 pool keep connections open when returned to the poo

Re: Psycopg2 pool clarification

2017-06-06 Thread dieter
israel writes: > Since I've gotten no replies to this, I was wondering if someone could > at least confirm which behavior (my expected or my observed) is > *supposed* to be the correct? Should a psycopg2 pool keep connections > open when returned to the pool (if closed is Fal

Re: Psycopg2 pool clarification

2017-06-06 Thread israel
Since I've gotten no replies to this, I was wondering if someone could at least confirm which behavior (my expected or my observed) is *supposed* to be the correct? Should a psycopg2 pool keep connections open when returned to the pool (if closed is False), or should it close them as lo

Psycopg2 pool clarification

2017-06-02 Thread Israel Brewster
I've been using the psycopg2 pool class for a while now, using code similar to the following: >>> pool=ThreadedConnectionPool(0,5,) >>> conn1=pool.getconn() >>> >>> pool.putconn(conn1) repeat later, or perhaps "simultaneously" in a differ

Re: Psycopg2 to create a record using a FK

2016-03-12 Thread Aaron Christensen
On Sat, Mar 12, 2016 at 9:57 PM, Aaron Christensen < aaron.christen...@gmail.com> wrote: > > > On Sat, Mar 12, 2016 at 5:03 AM, dieter wrote: > >> Aaron Christensen writes: >> > I am running the following versions of software: >> > >> >

Re: Psycopg2 to create a record using a FK

2016-03-12 Thread Aaron Christensen
On Sat, Mar 12, 2016 at 5:03 AM, dieter wrote: > Aaron Christensen writes: > > I am running the following versions of software: > > > > Python 3.5 > > psycopg2==2.6.1 > > Postgres 9.4.5 > > > > I have 2 tables. Table User has UserId (serial PK),

Re: Psycopg2 to create a record using a FK

2016-03-12 Thread Aaron Christensen
On Sat, Mar 12, 2016 at 5:26 AM, Peter Otten <__pete...@web.de> wrote: > Aaron Christensen wrote: > > > Hello, > > > > I am running the following versions of software: > > > > Python 3.5 > > psycopg2==2.6.1 > > Postgres 9.4.5 > > >

Re: Psycopg2 to create a record using a FK

2016-03-12 Thread Peter Otten
Aaron Christensen wrote: > Hello, > > I am running the following versions of software: > > Python 3.5 > psycopg2==2.6.1 > Postgres 9.4.5 > > I have 2 tables. Table User has UserId (serial PK), LastName, FirstName, > Gender, DateOfBirth, and DateEnrolled. Table U

Re: Psycopg2 to create a record using a FK

2016-03-12 Thread dieter
Aaron Christensen writes: > I am running the following versions of software: > > Python 3.5 > psycopg2==2.6.1 > Postgres 9.4.5 > > I have 2 tables. Table User has UserId (serial PK), LastName, FirstName, > Gender, DateOfBirth, and DateEnrolled. Table UserProfile has Use

Psycopg2 to create a record using a FK

2016-03-11 Thread Aaron Christensen
Hello, I am running the following versions of software: Python 3.5 psycopg2==2.6.1 Postgres 9.4.5 I have 2 tables. Table User has UserId (serial PK), LastName, FirstName, Gender, DateOfBirth, and DateEnrolled. Table UserProfile has UserProfileId (serial, PK), UserId (FK), DateEntered

Re: Can't find way to install psycopg2 in 3.5

2015-12-14 Thread Michael Poeltl
hi, I'm used to compile postgresql from source (last time it was postgresql-9.4.4 with ./configure --prefix=/usr --enable-thread-safety --docdir=/usr/share/doc/postgresql-9.4.4 --with-tcl --with-openssl --enable-nls=de --with-libxml on my linuxmint17-box) and then the installation of psy

Re: Can't find way to install psycopg2 in 3.5

2015-12-14 Thread Chris Angelico
On Mon, Dec 14, 2015 at 5:20 PM, Dhaval Parekh - NCrypted wrote: > I've digged a lot but I couldn't find psycopg2 for python 3.5. Here's where I'd get a psycopg2 binary: http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg If you've tried that and still can't get

Can't find way to install psycopg2 in 3.5

2015-12-14 Thread Dhaval Parekh - NCrypted
Hello, I'm newbie in using python. I've installed python 3.5 and django 1.9 to develop web application. I wanted to set postgresql as a DBMS but I couldn't complete the setup as it was continuously throwing me an error that psycopg2 module not found. I've digged a lot

Re: Windows permission error, 64 bit, psycopg2, python 3.4.2

2015-02-26 Thread Malik Rumi
rflow to work because installing Windows SDK 7.1 fails for me. > > > > So I stumbled across a precompiled psycopg2, and that reported that it > > worked, but then I got two permission errors. Then I read that this was a > > bug in python (issue 14252) that had been fixed, but I

Re: Windows permission error, 64 bit, psycopg2, python 3.4.2

2015-02-26 Thread Mark Lawrence
On 26/02/2015 15:10, Malik Rumi wrote: I am one of those struggling with compile issues with python on 64 bit windows. I have not been able to get the solutions mentioned on Stack Overflow to work because installing Windows SDK 7.1 fails for me. So I stumbled across a precompiled psycopg2

Windows permission error, 64 bit, psycopg2, python 3.4.2

2015-02-26 Thread Malik Rumi
I am one of those struggling with compile issues with python on 64 bit windows. I have not been able to get the solutions mentioned on Stack Overflow to work because installing Windows SDK 7.1 fails for me. So I stumbled across a precompiled psycopg2, and that reported that it worked, but

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread andydtaylor
Mark - it's more that I just didn't understand what you mean. Here's you: Probably an out and out programmer; uses a number of languages; a decade of experience, educated in best practice via your experience. Here's me: Idiot. A decade of experience in VBA and Excel in mindless finance jobs, h

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Mark Lawrence
On 01/09/2014 13:32, andydtay...@gmail.com wrote: Posting style point taken. Google groups doesn't exactly help you with that. Thunderbird is as good a solution as any although there are plenty of other choices. * Statements like "Please equip yourself with a tool that provides us with som

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Chris Angelico
On Mon, Sep 1, 2014 at 10:32 PM, wrote: > Posting style point taken. Google groups doesn't exactly help you with that. > > * You guys have probably been tinkering with this stuff for years. I haven't. > * Your man on the street would say I described the error fairly well. > * It's not like I wasn

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Andrea D'Amore
On 2014-09-01 12:32:38 +, andydtay...@gmail.com said: Google groups doesn't exactly help you with that. Drop it, get a usenet client or subscribe the mailing list (the newsgroup and the ml are bridged IIRC). * Your man on the street would say I described the error fairly well. That m

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread andydtaylor
Posting style point taken. Google groups doesn't exactly help you with that. * You guys have probably been tinkering with this stuff for years. I haven't. * Your man on the street would say I described the error fairly well. * It's not like I wasn't trying my best to fix it myself * So far as e

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread Andrea D'Amore
You make hard to follow your messages both by sending lot of messages and not using an adequate quoting. Please pick a posting style [1] (possibly interleaved) and stick to it. On 2014-08-31 23:35:09 +, andydtay...@gmail.com said: Andrea - yes I am using the virtualenv interpreter as the Pyc

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread Mark Lawrence
On 01/09/2014 00:57, andydtay...@gmail.com wrote: FYI My mac version is Mavericks 10.9.4 Please equip yourself with a tool that provides us with some context. There's not much that we can make out of the one line you give above. -- My fellow Pythonistas, ask not what our language can do for

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
I have gone ahead and set it all up by using pip install psycopg2 but I would still like to determine why Pycharm couldn't find the $PATH variable -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
FYI My mac version is Mavericks 10.9.4 -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Chris- I have removed the second copy of postgres I had (postgres.app) and updated path variables in .bash_profile: export PATH=$PATH:/usr/local/share/python export PATH=$PATH:/usr/local/bin export PYTHONPATH=$PYTHONPATH:/usr/local/bin/python export PATH=$PATH:/usr/local/Cellar/postgresql/9

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Chris- I have removed the second copy of postgres I had (postgres.app) and updated path variables in .bash_profile: export PATH=$PATH:/usr/local/share/python export PATH=$PATH:/usr/local/bin export PYTHONPATH=$PYTHONPATH:/usr/local/bin/python export PATH=$PATH:/usr/local/Cellar/postgresql/9.3.5_

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread Andrea D'Amore
On 2014-08-31 14:19:24 +, andydtay...@gmail.com said: - Installing to a virtualenv python environment. Are you using the virtualenv interpreter as the Pycharm project interpreter? -- Andrea -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread Chris “Kwpolska” Warrick
?q=define+puzzle ). That’s a problem. > I have been trying to setup a project in Pycharm with psycopg2. > > If I install it using pip install it is added. However if I use the Pycharm > "preferences>project interpreter>add package" option it fails with the below >

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
ave been trying to setup a project in Pycharm with psycopg2. > > > > If I install it using pip install it is added. However if I use the Pycharm > "preferences>project interpreter>add package" option it fails with the below > message. > > > > &

Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Hi, I have a puzzle, for which I would appreciate your opinion on! I have been trying to setup a project in Pycharm with psycopg2. If I install it using pip install it is added. However if I use the Pycharm "preferences>project interpreter>add package" option it fails with th

Re: Psycopg2 : error message.

2014-05-19 Thread Tim Roberts
dandrigo wrote: > >I'm writing a python script for a web service. I have to connect to my >postgres/postgis databases via Psycopg2. > >I writed a little first script just to connect to my pg/postgis db and drop >a test db. > >But when i execute the python file,

Re: Psycopg2 : error message.

2014-05-16 Thread Chris Angelico
On Fri, May 16, 2014 at 8:18 PM, dandrigo wrote: > Please read the 2 usefull files below : > > Dandrigo pg_test.py > > SS_dos.JPG These would be MUCH better included inline. Please, i

Psycopg2 : error message.

2014-05-16 Thread dandrigo
Dear all, I'm writing a python script for a web service. I have to connect to my postgres/postgis databases via Psycopg2. I writed a little first script just to connect to my pg/postgis db and drop a test db. But when i execute the python file, i have several error messages. Please

Re: Problem with psycopg2, bytea, and memoryview

2013-08-01 Thread Frank Millman
"Terry Reedy" wrote in message news:ktbj9i$4au$1...@ger.gmane.org... > On 7/31/2013 9:07 AM, Antoine Pitrou wrote: >> >> I would suggest asking the psycopg2 project why they made this choice, >> and >> if they would reconsider. Returning a memoryview do

Re: Problem with psycopg2, bytea, and memoryview

2013-08-01 Thread Frank Millman
gt; > A memoryview will compare equal to another object that supports > the buffer protocol when the format and shape are also equal. The > database must be returning chunks of binary data in a different > shape or format than you are writing it. > > Perhaps psycopg2 is returning a chu

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread dieter
"Frank Millman" writes: > ... > At present, I loop over a range of columns, comparing 'before' and 'after' > values, without worrying about their types. Strings are returned as str, > integers are returned as int, etc. Now I will have to check the type of each > column before deciding whether

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Terry Reedy
On 7/31/2013 9:07 AM, Antoine Pitrou wrote: Frank Millman chagford.com> writes: Thanks for that, Antoine. It is an improvement over tobytes(), but i am afraid it is still not ideal for my purposes. I would suggest asking the psycopg2 project why they made this choice, and if they wo

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Neil Cerutti
t;>> database. For PostgreSQL I use a column with datatype 'bytea', which is >>> their recommended way of storing binary strings. >>> >>> I use psycopg2 to access the database. It returns binary data >>> in the form of a python 'memoryview

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
"Antoine Pitrou" wrote in message news:loom.20130731t150154-...@post.gmane.org... > Frank Millman chagford.com> writes: >> >> Thanks for that, Antoine. It is an improvement over tobytes(), but i am >> afraid it is still not ideal for my purposes. > > I w

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Antoine Pitrou
Frank Millman chagford.com> writes: > > Thanks for that, Antoine. It is an improvement over tobytes(), but i am > afraid it is still not ideal for my purposes. I would suggest asking the psycopg2 project why they made this choice, and if they would reconsider. Returning a memory

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
7;bytea', which is >> their recommended way of storing binary strings. >> >> I use psycopg2 to access the database. It returns binary data in the form >> of >> a python 'memoryview'. >> > [...] >> >> Using MS SQL Server and pyodbc

Re: Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Antoine Pitrou
Frank Millman chagford.com> writes: > > I have some binary data (a gzipped xml object) that I want to store in a > database. For PostgreSQL I use a column with datatype 'bytea', which is > their recommended way of storing binary strings. > > I use psycopg2 to

Problem with psycopg2, bytea, and memoryview

2013-07-31 Thread Frank Millman
Hi all I don't know if this question is more appropriate for the psycopg2 list, but I thought I would ask here first. I have some binary data (a gzipped xml object) that I want to store in a database. For PostgreSQL I use a column with datatype 'bytea', which is their rec

Re: psycopg2 craziness

2013-02-21 Thread Chris Angelico
On Fri, Feb 22, 2013 at 10:27 AM, wrote: cursor_to.execute("CREATE TABLE foo (id serial PRIMARY KEY);") Like many things, it's silent when everything works. As MRAB suggested, you probably need to commit before the changes become visible; unlike certain other database engines, PostgreSQL ac

Re: psycopg2 craziness

2013-02-21 Thread andydtaylor
I'd actually forgotten about commit, thanks! I'll have another go with this in mind. -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 craziness

2013-02-21 Thread MRAB
On 2013-02-21 23:27, andydtay...@gmail.com wrote: Hi, I'm trying to use psycopg2 but having some issues. Would it be possible to get some pointers? I seem unable to execute any SQL statements. So here are my database tables before (and after) I try to do anything: postgres=# \c Yo

psycopg2 craziness

2013-02-21 Thread andydtaylor
Hi, I'm trying to use psycopg2 but having some issues. Would it be possible to get some pointers? I seem unable to execute any SQL statements. So here are my database tables before (and after) I try to do anything: postgres=# \c You are now connected to database "postgres" as

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 09:20:10 PM EST, andydtay...@gmail.com wrote: Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I w

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I will have to look into the following: 1. Retrieving this data from

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread MRAB
On 2013-01-10 00:19, andydtay...@gmail.com wrote: Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which works actually,

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
Which works actually, but unfortunately that's not educating me suffieciently. Actual error message I see follows. - - - - - - - - - - - - - - - - - - - - - - - - - Code: #!/usr/bin/python import psycopg2 import sys def main(): db = psycopg2.connect( host = 'localhost&#x

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
ucating me suffieciently. Actual error message I see follows. - - - - - - - - - - - - - - - - - - - - - - - - - Code: #!/usr/bin/python import psycopg2 import sys def main(): db = psycopg2.connect( host = 'localhost', database = 'gisdb', use

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread John Gordon
ar but that > didn't work. I've gone a bit blind looking at it, but hopefully you can set > me right. With the '#'d out lines instead the file does work. > #!/usr/bin/python > import psycopg2 > import sys > def main(): >db = psycopg2.connect( >

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
#'d out lines instead the file does work. What am I missing? Thanks Andy #!/usr/bin/python import psycopg2 import sys def main(): db = psycopg2.connect( host = 'localhost', database = 'gisdb', user = 'postgres', password = '##

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Walter Hurry
eventing this from working, and I don't know enough >> to figure it out, despite having spent most of today reading up. The >> code executes with no error, yet no table is created or populated. >> >> Can anyone offer me some advice? code below. >> >> Thanks, >

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 9:14 AM, Mitya Sirenef wrote: > On Sun 06 Jan 2013 04:53:32 PM EST, andydtay...@gmail.com wrote: >> >> Wow it's as simple as that! I'm afraid my database experience is in >> Microsoft Access in Windows and not at the command line, so that wasn't >> intuitive for me. >> > IIR

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Mitya Sirenef
On Sun 06 Jan 2013 04:53:32 PM EST, andydtay...@gmail.com wrote: Wow it's as simple as that! I'm afraid my database experience is in Microsoft Access in Windows and not at the command line, so that wasn't intuitive for me. Thanks again, Andy IIRC I made the same mistake when I was using psy

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread andydtaylor
Wow it's as simple as that! I'm afraid my database experience is in Microsoft Access in Windows and not at the command line, so that wasn't intuitive for me. Thanks again, Andy -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread Chris Angelico
On Mon, Jan 7, 2013 at 8:38 AM, wrote: > But something is preventing this from working, and I don't know enough to > figure it out, despite having spent most of today reading up. The code > executes with no error, yet no table is created or populated. Standard databasing requirement: You need

  1   2   3   >