https://github.com/3mcloud/falcano
A pythonic interface to Amazon's DynamoDB for single-table design
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 13 committers (7.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.2%) to scientific vocabulary
Keywords
Repository
A pythonic interface to Amazon's DynamoDB for single-table design
Basic Info
Statistics
- Stars: 60
- Watchers: 8
- Forks: 11
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
Falcano
A Pythonic interface for Amazon's DynamoDB that supports Python 3 and single-table design based on PynamoDB.
Installation
bash
pip install falcano
Basic Usage
Basic usage is nearly identical to PynamoDB. Meta must inherit from Model.Meta and Type must be defined for every model.
Create a model that describes a model in your table.
```python from falcano.model import Model from falcano.attributes import UnicodeAttribute
class User(Model): ''' A DynamoDB User ''' class Meta(Model.Meta): tablename = 'dynamodb-user' billingmode = 'PAYPERREQUEST' email = UnicodeAttribute(null=True) firstname = UnicodeAttribute(rangekey=True) lastname = UnicodeAttribute(hashkey=True) Type = UnicodeAttribute(default='user') ```
Create the table if needed:
python
User.create_table(billing_mode='PAY_PER_REQUEST')
Create a new user:
python
user = User('John', 'Denver')
user.email = 'djohn@company.org'
user.save()
Now, search your table for all users with a last name of 'Denver' and whose first name begins with 'J':
python
for user in User.query('Denver', User.first_name.startswith('J')):
print(user.first_name)
Examples of ways to query your table with filter conditions:
python
for user in User.query('Denver', User.email.eq('djohn@company.org')):
print(user.first_name)
for user in User.query('Denver', User.email=='djohn@company.org'):
print(user.first_name)
Retrieve an existing user:
python
try:
user = User.get('John', 'Denver')
print(user)
except User.DoesNotExist:
print('User does not exist')
Advanced Usage
Indexes? No problem:
```python from falcano.model import Model from falcano.indexes import GlobalSecondaryIndex, AllProjection from falcano.attributes import NumberAttribute, UnicodeAttribute
class ViewIndex(GlobalSecondaryIndex): class Meta: billingmode = 'PAYPERREQUEST' projection = AllProjection() view = NumberAttribute(default=0, hashkey=True)
class TestModel(Model): class Meta(Model.Meta): tablename = 'TestModel' forum = UnicodeAttribute(hashkey=True) thread = UnicodeAttribute(rangekey=True) view = NumberAttribute(default=0) Type = UnicodeAttribute(default='test') viewindex = ViewIndex() ```
Now query the index for all items with 0 views:
python
for item in TestModel.view_index.query(0):
print(f'Item queried from index: {item}')
It's simple!
Want to use DynamoDB local? Add a host name attribute and specify your local server.
```python from falcano.models import Model from falcano.attributes import UnicodeAttribute
class User(Model): ''' A DynamoDB User ''' class Meta(Model.Meta): tablename = 'dynamodb-user' host = 'http://localhost:8000' email = UnicodeAttribute(null=True) firstname = UnicodeAttribute(rangekey=True) lastname = UnicodeAttribute(hash_key=True) Type = UnicodeAttribute(default='user') ```
Single-Table Design Usage
Want to follow single-table design with an index and rename the Type attribute? No problem:
```python from falcano.model import Model from falcano.indexes import GlobalSecondaryIndex, AllProjection from falcano.attributes import NumberAttribute, UnicodeAttribute
class TypeIndex(GlobalSecondaryIndex): class Meta: indexname = 'Type' billingmode = 'PAYPERREQUEST' projection = AllProjection() Kind = UnicodeAttribute(default=0, hash_key=True)
class BaseModel(Model): class Meta(Model.Meta): tablename = 'singletable' # use the Kind attribute in place of Type for deserialization modeltype = 'Kind' PK = UnicodeAttribute(hashkey=True) SK = UnicodeAttribute(range_key=True) TypeIndex = TypeIndex()
class User(BaseModel): email = UnicodeAttribute(null=True) Kind = UnicodeAttribute(default='user')
class Team(BaseModel): owner = UnicodeAttribute(null=True) Kind = UnicodeAttribute(default='team') ```
Features
- Python >= 3.8 support
- Use of
Tableboto3 resource- DynamoDB API
conditionsobjects - Auto-Typing
- DynamoDB API
- An ORM-like interface with query and scan filters
- Compatible with DynamoDB Local
- Support for Unicode, Binary, JSON, Number, Set, and UTC Datetime attributes
- Support for Global and Local Secondary Indexes
- Automatic pagination for bulk operations(?)
- Complex queries
- Multiple models per table and deserialization into objects
Features not yet implemented
- Provides iterators for working with queries, scans, that are automatically - paginated
- Iterators for working with Query and Scan operations
- Supports the entire DynamoDB API
- Full table backup/restore
- Batch operations with automatic pagination
Owner
- Name: 3M
- Login: 3mcloud
- Kind: organization
- Location: Maplewood, MN
- Website: https://www.3m.com
- Repositories: 11
- Profile: https://github.com/3mcloud
Science. Applied to life.
GitHub Events
Total
- Fork event: 1
Last Year
- Fork event: 1
Committers
Last synced: almost 3 years ago
All Time
- Total Commits: 100
- Total Committers: 13
- Avg Commits per committer: 7.692
- Development Distribution Score (DDS): 0.72
Top Committers
| Name | Commits | |
|---|---|---|
| a9phhzz | a****z@m****m | 28 |
| Eric Walker | e****3@m****m | 22 |
| Kevin Truckenmiller | k****r@m****m | 16 |
| pj | s****p@c****u | 12 |
| Michael Neil | a****z@m****m | 5 |
| Eric Walker | e****8@g****m | 4 |
| Erik Sandberg | 3****g@u****m | 3 |
| jjf130 | 7****0@u****m | 3 |
| a8xwzzz | b****3@m****m | 2 |
| PJ Sangvong | 5****g@u****m | 2 |
| Shawn Aucoin | s****w@m****m | 1 |
| Neil Stewart | n****n@N****l | 1 |
| Blaise Thompson | b****n@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 6
- Total pull requests: 43
- Average time to close issues: 3 months
- Average time to close pull requests: 8 days
- Total issue authors: 5
- Total pull request authors: 10
- Average comments per issue: 2.0
- Average comments per pull request: 0.16
- Merged pull requests: 39
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- njsnx (2)
- mneil (1)
- roykingtree (1)
- ivoire (1)
- blaisethompson (1)
Pull Request Authors
- jjf130 (17)
- erictwalker18 (9)
- ktruckenmiller (5)
- mneil (3)
- blaisethompson (3)
- sukritsangvong (2)
- njsnx (1)
- Dirk-Sandberg (1)
- saucoin (1)
- gHerzmann (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 2,945 last-month
- Total dependent packages: 0
- Total dependent repositories: 2
- Total versions: 10
- Total maintainers: 1
pypi.org: falcano
Falcano
- Homepage: https://github.com/3mcloud/falcano
- Documentation: https://falcano.readthedocs.io/
- License: BSD License
-
Latest release: 0.0.10
published over 4 years ago