Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
accessing postgresql
#1
if you use postgresql from python: what is your favorite way to access postgresql in python?

i am looking to see which is more popular here.

the application i have needs to store many rows/records that each have a date range and needs to "read" all the rows/records where its range include the specified date. or could this be done just as fast with a sequential file testing each row/record to see if the date falls in the range.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
This should be asyncpg. I've come across this recently
However, I didn't play with postgre yet. A little sqlite3
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
i did some PostgreSQL a few years ago when i did some web stuff for a client.  their DBA gave me the Python stuff they set up their databases with but i don't remember it and didn't save it. it was customized by them, anyway.  they were a Python shop and all their programmers used Python and R (i didn't do any of that part).  this project is one of my own and i'm not sure a relational DB will really help.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
Pick one of the NoSQL thеn
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
py-postgresql: http://python.projects.pgfoundry.org/
for many things likedatabase load and create, I use psql scripts and PgAdmin which
is one of the, (if not the) best admins available.
Reply
#6
(Jun-10-2017, 05:13 AM)Skaperen Wrote: what is your favorite way to access postgresql in python?
Usually Flask-SQLAlchemy.
With this URI for PostgreSQL.
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://snippsat:password@localhost/app'
Sometime dataset for fast setup.
There is lot of cool stuff to use Redis, Peewee, RethinkDB, Pony ORM
Reply
#7
yeah, i'm considering no-sql, now, or just a few plain files (with names divided up by account number modulo some chosen value).  most of the processing needs to read every record.  some will need to just read records for a specific account.

the only table relations i see is between a table of accounts (who has that account, passwords, etc) which will be small, and a table of service purchases with date-to-date of purchase, when they purchased, credit approval id, and their account.  a daily process will produce a list of accounts that purchased service for that date.  a web page will take purchases.  a web page will take support requests and insert them in a directory, including refund/cancel requests. i don't think this is so sophisticated to make a relational database an absolute necessity.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#8
A document nosql database could hold all of this. I think
I didn't use one of these either.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#9
perhaps. i have never used those, so i don't know how they structure multiple items into a record/row. but i have done that into a file in c and in python using pickle (trusted writer). i could come up with different ways if needed since i don't need to use common abstractions (just my own is good enough since it will be all my code).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PostgreSQL announcement Larz60+ 0 1,912 Aug-03-2018, 01:55 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020