Niivii commented on PR #2494:
URL: https://github.com/apache/arrow-adbc/pull/2494#issuecomment-2649218925

   Hello @zeroshade,
   
   This should do the trick:
   
   ```python
   import adbc_driver_snowflake.dbapi
   import numpy as np
   import polars as pl
   
   
   def main() -> None:
       big_df = generate_big_dataframe(num_rows=5000000)
       with create_snowflake_connection() as snowflake_connection:
           big_df.write_database(table_name="my_table", 
connection=snowflake_connection,
                                 if_table_exists="append", engine="adbc")
   
   
   def generate_big_dataframe(num_rows: int) -> pl.DataFrame:
       rng = np.random.default_rng(12345)
       data = {
           "column_int": rng.integers(low=-10000, high=10000, size=num_rows),
           "column_float": rng.random(size=num_rows),
           "column_string": rng.choice(["A", "b", "cdefghijkl", 
"âozZEzaéXZez"], size=num_rows),
       }
       return pl.DataFrame(data=data)
   
   
   def create_snowflake_connection() -> adbc_driver_snowflake.dbapi.Connection:
       return adbc_driver_snowflake.dbapi.connect(db_kwargs={
           "username": "myusername",
           "adbc.snowflake.sql.account": "myaccount",
           "adbc.snowflake.sql.auth_type": "auth_ext_browser",
           "adbc.snowflake.sql.warehouse": "mywarehouse",
           "adbc.snowflake.sql.role": "myrole",
           "adbc.snowflake.sql.db": "mydb",
           "adbc.snowflake.sql.schema": "myschema",
       })
   
   
   if __name__ == "__main__":
       main()
   
   ```
   
   python>=3.13
   polars>=1.22.0
   adbc-driver-snowflake>=1.4.0
   pyarrow>=19.0.0
   numpy>=2.2.2
   
   Let me know if you can reproduce.
   Problem might come from the 'append' method with existing data.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to