Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlalchemy
- import pyodbc
- print('hello world')
- connection = pyodbc.connect('Driver={SQL Server};Server=.\\SQLSTANDARD;;Database=MarcinDB;uid=marcin;pwd=marcin')
- print("Połączono")
- cursor = connection.cursor()
- #sql_command = ("CREATE TABLE Osoby ( staff_number INTEGER PRIMARY KEY, imie VARCHAR(20),nazwisko VARCHAR(30),mail VARCHAR(40));")
- #cursor.execute(sql_command)
- sql_command = ("""INSERT INTO Osoby (staff_number, imie, nazwisko, mail)
- VALUES (4, 'Anna', 'Karenina', 'anna@ja.pl');""")
- cursor.execute(sql_command)
- cursor.commit()
- sql_command = ("""INSERT INTO Osoby (staff_number, imie, nazwisko, mail)
- VALUES (2, 'Jacek', 'Placek', 'jacek@placek.pl');""")
- cursor.execute(sql_command)
- cursor.commit()
- # SQL Query
- """
- SQLCommand = ("select * from CUSTOMERS")
- # Processing Query
- cursor.execute(SQLCommand)
- i = 1
- for rows in cursor.fetchall():
- print("------------CUSTOMERS %d-----------------" % i)
- for field in rows:
- print(str(field))
- print("---------------------------------------")
- print('')
- i = i + 1
- """
- # closing connection
- connection.close()
- print("Zamknięto połączenie")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement