IPython Extension for Cosmos SQL
Перейти к файлу
microsoft-github-policy-service[bot] 7b7cc74c7a
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2023-03-28 16:44:39 +00:00
cosmos_sql added user agent prefix 2020-03-18 13:36:05 -07:00
.gitignore Initial commit 2019-06-17 11:22:52 -07:00
CODEOWNERS added code owner file 2019-08-19 17:21:49 -07:00
LICENSE Initial commit 2019-06-17 11:22:56 -07:00
MANIFEST.in cosmos sql 2019-06-17 11:29:45 -07:00
Makefile cosmos sql 2019-06-17 11:29:45 -07:00
README.md fixed readme style 2019-06-19 13:32:39 -07:00
SECURITY.md Microsoft mandatory file 2023-01-24 16:01:56 +00:00
requirements.txt bumped required version of azure-cosmos 2020-03-23 16:19:57 -07:00
sample.ipynb included jupyter notebook sample 2019-06-19 13:10:17 -07:00
setup.py cosmos sql 2019-06-17 11:29:45 -07:00

README.md

ipython-cosmos-extension

IPython Extension for Cosmos SQL

Install the extension:

!pip install  ipython-cosmos-extension

Load the extension:

This extension assumes cosmosdb endpoint credentials are set as environment variables accessible by COSMOS_ENDPOINT and COSMOS_KEY.

%load_ext cosmos_sql

Set Database name

%database <your_database_name>

Set Container name

%container <your_container_name>

Execute Cosmos SQL Statements

%%sql
select * from user

or you can specify different database or collection

%%sql --database testdb --container testcol2
SELECT top 1 r.id, r._ts from r order by r._ts desc

To get the result from the command use _ variable.

Auto conversion of result to data frame

Disabling auto conversion of result to dataframe:

%disable_autoconvert_to_dataframe 

Enabling auto conversion of result to dataframe:

%enable_autoconvert_to_dataframe 

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.