Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymssql
- import pandas as pd
- conn = pymssql.connect(server="localhost",
- user="SA",password="Tammar11", port=1433)
- cursor = conn.cursor()
- cursor.execute('use TestDB')
- #cursor.execute("drop test_table")
- cursor.execute("""
- CREATE TABLE test_table (ddd INT)""")
- stmt = "SELECT * from test_table"
- df = pd.read_sql(stmt,conn)
- print df.shape
- for x in range(1000):
- cursor.execute("insert into test_table values("+str(x)+")")
- stmt = "SELECT * from test_table"
- df = pd.read_sql(stmt,conn)
- df.shape
- import pymssql
- import pandas as pd
- conn = pymssql.connect(server="localhost",
- user="SA",password="Tammar11", port=1433)
- cursor = conn.cursor()
- cursor.execute('use TestDB')
- stmt = "SELECT * from test_table"
- df = pd.read_sql(stmt,conn)
- df.shape
- DatabaseError: Execution failed on sql 'SELECT * from test_table':
- (208, "Invalid object name 'test_table'.DB-Lib error message 20018,
- severity 16:nGeneral SQL Server error: Check messages from the SQL
- Servern")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement