خرید بک لینک

Vote count: 0

I have a bunch of shards (databases) that I'm querying for data, and then I need to create a manifest file for S3. Would it be bad practice to put the manifest object at the class level like so:

class Shard(mu.PrettyStr):
    # Tracks files on a class level for manifest creation.
    manifest = aws.S3Manifest()

And then manipulate it like so:

Shard.manifest.add_record(
            s3_destination=s3.get_full_destination()
        )

or

cu.Shard.manifest.create_manifest() 

asked 4 mins ago

1 Answer

Vote count: 0

Putting it as a class instance means that that the manifest class will be instantiated when Shard is defined, not when it is instantiated. If that's OK, then what you've done is fine.

If you would rather defer this until there's at least one instance of your class, define it as None on the class and then instantiate it in Shard.__init__() if the attribute is not None.

answered 34 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 14 ارديبهشت 1395 ساعت: 6:32

صفحه بندی