Skip to content

CLI for querying Azure Service Fabric Reliable Collections

License

Notifications You must be signed in to change notification settings

shalabhms/reliable-collections-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interact with your reliable collections using rcctl

rcctl is an easy-to-consume python package that allows you to interact with your query-enabled Service Fabric service using command line or python

rcctl only works for query-enabled services. To add querying capabilities to your service visit the service-fabric-queryable repository.

Installing

To install and start using rcctl, make sure you have python <= 3.6 and pip installed (pip may have came with your python distro). Then, install rcctl using

pip install rcctl

Using rcctl

Click here for a full example walkthrough of using rcctl.

To get started, simply open a command prompt window and enter

rcctl -h

If your cluster is not an a local endpoint, you must connect to it using rcctl cluster select before being able to interact with your service. Connecting to a cluster in rcctl works the same way as it does in sfctl.

Basic Commands

Once you have connected, you can use rcctl dictionary to list your reliable dictionaries, find out about the schema of a reliable dictionary, and then find out more about any complex type-schema in that schema. You can then query against any dictionary in your query-enabled service, and execute updates to that collection.

Note that at this time execute is not well supported, so is use-at-your-own risk

Querying on rcctl

Queries against service-fabric-querying are written in the OData format. The querying middleware supports the following commands, which can be thought of like SQL:

SQL OData
SELECT $select
LIMIT $top
WHERE $filter
ORDER BY $orderby

The querying middleware supports all the logical operators provided by the OData convention.

Using the sfquery interface

rcctl is the command line wrapper of its underlying package sfquery. If instead of command line, you would like to use the sfquery interface, you can do so in a Jupyter notebook. Jupyter notebooks are local, web-based python kernels that offer widgets and interaction.

To open the sfquery interface, open a new jupyter notebook by entering in command line

jupyter notebook

That should open up a web browser. You can then make a new python notebook and enter the following:

from sfquery import *
cluster = Cluster(Authentication(), 'http://localhost:19080/')
interface = Interface(cluster)
  • If your cluster is deployed, replace http://localhost:19080/ with your cluster's endpoint
  • If your cluster is cert-authenticated, instead of Authentication() use
ClientCertAuthentication(r"C:\path\to\your\unencrypted.pem", None, True)
# secondary arguments are your certificate authority and whether you want to not verify your cluster's cert

At this point, you should see this interface. Feel free to fiddle with it and try some OData queries.

jupyter interface

If your jupyter notebook says it cannot find sfquery, your notebook's python kernel may be different than the one your computer is using. You can install sfquery to your jupyter notebook from your notebook using:

!pip install sfquery

Using the sfquery API

For more advanced usage, you may want to use the sfquery python package directly. You can find the API documentation here.

Contributing

Contributions are welcome on this project. See Contributing.md for information on how to go about contributing to this project.

About

CLI for querying Azure Service Fabric Reliable Collections

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages