can anyone point me to a good source regarding Python scripting using Vertica connection?

STST Registered User

Comments

  • Python scripting in Vertica goes through PyODBC. (Though there are a variety of user-developed packages out there that connect it with other tools.) If you're new to PyODBC, you can look through our documentation, specifically the Python section of the Programmer's Guide: https://my.vertica.com/docs/CE/6.0.1/PDF/Programmer's%20Guide.pdf If you're already familiar with PyODBC, the best short quick-start guide I've found is actually on Vertica's unofficial user forums (hi vertica-forums!): http://vertica-forums.com/viewtopic.php?t=489 One performance tip: As you may know, Vertica is really optimized for serving a smallish number of connections running a small number of large, expensive queries. Python tools ported directly from other databases sometimes open lots and lots of short-lived connections to run zillions of short queries by default. This will work, but if you can modify or configure them to do bigger single queries and to re-use connections, you'll find that they work much better.
  • STST Registered User
    Thank you very much, Adam! These are indeed very helpful and I'll read them. I'm almost new to both, Python and Vertica. I've managed to successfully run a very short script on my local Mac but when I run it on a Linux machine, I get the following error. Everything on both machines (odbc.ini, Python version, Python libraries, etc.) seems identical and I don't understand why I'm getting the error. I tested the odbc on the Linux machine via isql and I was able to connect. Any thoughts? File "iaoStory.py", line 12, in cnxn = get_connection(DSN) File "build/bdist.linux-x86_64/egg/pyvertica/connection.py", line 37, in get_connection TypeError: no connection information was passed
  • Hm... It looks like you're using PyVertica, which is a third-party library that wraps PyODBC (and does a few things on top of it). Could you try connecting using PyODBC directly, per the docs above? That will help narrow things down.
  • STST Registered User
    good call... ok, I'll use just PyODBC. will get back here to update :)
  • STST Registered User
    good call... ok, I'll use just PyODBC. will get back here to update :)
  • STST Registered User
    seems to be working, thank you :)

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file