CommencerCommencez gratuitement

Reading from SQLite with a URI

A local SQLite database has been prepared with the digital format summary the team uses every week. Use Polars' URI-based reader with the ADBC engine, which transfers data in Arrow's columnar format so Polars can use it directly without any per-row Python conversion.

The connection URI is in uri and the SQL query is in query.

Cet exercice fait partie du cours

<cours>Scaling and Optimizing Data Pipelines with Polars</cours>
Voir le cours

Instructions de l’exercice

  • Run the query using Polars' URI-based read function.
  • Set the database engine to "adbc".

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

# Read the SQL query result into a Polars DataFrame
result = pl.____(
    query=query,
    uri=uri,
    # Use the ADBC engine
    engine="____",
)
print(result)
Modifier et exécuter le code