Advertisement
lasha_kitia

Untitled

Jan 7th, 2021
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. import psycopg2
  2. import psycopg2.extras
  3.  
  4.  
  5. cursor = %(connection/client)%.cursor(cursor_factory=psycopg2.extras.RealDictCursor)
  6. cursor.execute('''
  7.  INSERT INTO %table_name% (
  8.    Number,
  9.    Color,
  10.    Odd_even,
  11.    Low_high,
  12.    Column,
  13.    Sector
  14.  ) VALUES (
  15.    %(Number)s,
  16.    %(Color)s,
  17.    %(Odd_even)s,
  18.    %(Low_high)s,
  19.    %(Column)s,
  20.    %(Sector)s
  21.  )
  22. ''', {
  23.   'Number': '15',
  24.   'Color': 'black',
  25.   'Odd_even': 'odd',
  26.   'Low_high': '1/18',
  27.   'Column': 'Column3',
  28.   'Sector': 'Sector2'
  29. })
  30. cursor.commit()
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement