Describe the bug
From this discussion: https://www.reddit.com/r/MicrosoftFabric/comments/1p5oduh/comment/nquk0e7/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Polars data frames returns the following error:
ComputeError: could not append value: 2013-01-01 of type: date to the builder; make sure that all rows have the same schema or consider increasing `infer_schema_length`
it might also be that a value overflows the data-type's capacity
To reproduce
import struct
from os import getenv
from dotenv import load_dotenv
import polars as pl
from pyodbc import connect
def main():
load_dotenv()
# Establish a connection to the SQL Server database
connection = connect(getenv("SQL_CONNECTION_STRING"))
tables = ["Customers", "Invoices", "Orders"]
for table in tables:
query = f"SELECT TOP 5 * FROM Sales.{table}"
pl_data = pl.read_database(query=query, connection=connection)
print(pl_data)
# Close the connection
connection.close()
if __name__ == "__main__":
main()
Expected behavior
Script would run without error
Further technical details
Python version: any
SQL Server version: any
Operating system: any
Additional context
The database is the World Wide Importers Sample database
Describe the bug
From this discussion: https://www.reddit.com/r/MicrosoftFabric/comments/1p5oduh/comment/nquk0e7/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Polars data frames returns the following error:
To reproduce
Expected behavior
Script would run without error
Further technical details
Python version: any
SQL Server version: any
Operating system: any
Additional context
The database is the World Wide Importers Sample database