Git Product home page Git Product logo

inpynamodb's People

Contributors

iamjsd avatar jolacaleb avatar mmt-seongwoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inpynamodb's Issues

test failed: ValueError: No hash key attribute for index: uid_index

Test failed on test_model.test_index_*

        # on base.AsyncConnection.query
        tbl = self.get_meta_table(table_name)
        if tbl is None:
            raise TableError("No such table: {0}".format(table_name))
        if index_name:
            hash_keyname = tbl.get_index_hash_keyname(index_name)
            if not hash_keyname:
>               raise ValueError("No hash key attribute for index: {0}".format(index_name))
E               ValueError: No hash key attribute for index: uid_index

maybe related to: pynamodb/PynamoDB#316

moving PynamoDB methods into asyncio's world

Models

  • Model.create_table()
  • Model.delete_table()
  • Model.save()
  • Model.query()
  • Model.scan()
  • Model.delete()

Indexes

  • class GlobalSecondaryIndex
  • class LocalSecondaryIndex
  • Model.view_index.query()

Batch Operations

  • Model.batch_write()
  • Model.batch_get()
  • Model.scan()

Update

  • Model.update()
  • Model.update_item()

methods ordering

order of overridden methods in classes inherited from PynamoDB should be same order with parent class.

plugin needed

  • UUIDAttribute for automatically generate UUID (low priority)
  • PasswordAttribute as a serializer for auto encrypting, decrypting (high priority) -> EncryptedAttribute()

documentation

  • Documentation
    • readme.md
    • wiki (how-to-use, for developers)

blank string values in an attribute in Map Attribute turns to NoneType when using update statement on List

Trying to update a ListAttribute with a MapAttribute value. Some of the values in the MapAttribute have UnicodeAttribute with null=True, default="".
When initializing MapAttribute, the UnicodeAttributes mentioned above have string type "" in them, but when I try to add it to the ListAttribute through update, it raises the following error:

screen shot 2018-02-01 at 2 10 30 pm

I think the values degenerate between the process from calling the update function to the dispatch. Not sure if this is Inpynamodb problem or pynamodb problem

additional features

  • Table backup
  • Signals
    • post
    • pre
  • convert model to Dictionary. maybe Model.as_dict() -> should convert to dict all MapAttributes too. (Use get_attribute() if attr is MapAttribute then attr.as_dict()?)
  • Override Model._set_defaults() and make it public method, to be able to change model attributes if default is specified, otherwise no change.

Query using LastEvaluatedKey for GSI including the last evaluated key's item itself

Situation:
I have a global secondary index with a hash key and range key.
When I query the index using a certain hash key with a last evaluated key from a previous query,
I get the list of items that STARTS with the item of last evaluated key.
For example,
let the following list of items [a,b,c,d] be a hypothetical table that I have.
When I do limit = 1, then I get a.
When I do limit =1 and last_evaluated_key=last_evaluated_key of previous query(which is = to a as key), then I still get a.
When I do limit = 2, then I get [a,b].
When I do limit = 2 and last_evaluated_key=last_evaluated_key of previous query(which is = to b as key), then I get [b,c].

The issue does not occur on local secondary index. I am not sure about regular queries on the model itself.

v0.0.14 dependency issue

0.0.14 requires following dependency:

aiobotocore version 0.8.0 from 0.6.0
aiohttp version >= 3.1.0 from 3.0.0

but it causes this dependency issue:
image

in my case, solved with this:

boto3==1.7.12
botocore==1.10.12
aiohttp==3.1.0

Production-ready

Hi, I'd like to use it but want to be sure it is production-ready. I see no commits for 2 years. Does it work?

Create new InPynamo connection if loop is closed

Currently, in the _get_connection(), new connection is established if there isn't a cached instance of TableConnection. However, this means that even when a new event loop is generated, the Model instances refer to the old connection which may have closed and therefore unable to perform any actions.

A hotfix would be to change the logic in the _get_connection() method to account for this.
But I think this might really have to do with the "session" denoted by the session_cls keyword argument when creating TableConnection. Something more elaborate / smooth can be done with this.

`_get_attributes` is deprecated

  /Users/minjeongkim/.pyenv/versions/mmt-server-event/lib/python3.6/site-packages/pynamodb/attributes.py:232: UserWarning: `Model._get_attributes` is deprecated in favor of `Model.get_attributes` now
    warnings.warn("`Model._get_attributes` is deprecated in favor of `Model.get_attributes` now")

apparently, used in /inpynamodb/indexes.py:94, etc, ...

UTC location aware DateTime

Currently, when we save an object with a UTCDatetimeAttribute, if the tzinfo is not set, it is assumed that the timezone is UTC 00:00. However, this results in incorrect time data, since if I have the default equal to datetime.datetime.now, then it automatically assumes UTC 00:00 when the location may not necessarily be where UTC is 00:00.

I see two solutions.
One: a hard requirement to give the tzinfo as the parameter - this would break some of the existing code but it will put responsibility on individual developers to specify the tzinfo.
Two: the UTCDatetimeAttribute figuring out the tzinfo of the current location instead of simply defaulting to 00:00. This would be a cleaner solution I believe.

Version 4.1.0, closing connections

I get the following warning at the end of executing the code

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x1193fa0d0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x119419980>, 3.3025964)]']
connector: <aiohttp.connector.TCPConnector object at 0x1193fa050>

Should closing the aiobotocore client still be implemented or am I using it wrong?

Testing issues

  1. on test_base_connection.py
with patch(PATCH_METHOD) as req:
    req.side_effect = BotoCoreError . # This doesn't raise BotoCoreError exception.
    await self.assertAsyncRaises(TableError, conn.create_table(self.test_table_name, **kwargs))

tests

  • using tox
  • should pass PynamoDB's test
  • should pass asynchronous operation test

Issue with range_key_condition on query

Situation:
Attempting to execute query on a global secondary index of a model.
Attempted query :

query = Promotion.artist_index.query(artist_id, Promotion.progress != "D"))

screen shot 2018-03-09 at 5 07 14 pm

The query works with

Promotion.progress.startswith("D")

I am not sure what the problem might be. Please take a look into it when you have time. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.