Django database introspection tool, through the data table name can dynamically create a Django models ready-to-use objects.
Project description
# django-db-introspection
Django 数据库内省工具, 通过数据表名就可以动态创建一个即时可用的Django models对象。
仅仅需要一个表名,你就可以立即得到一个可用的Django 模型,并立即进行查询,更新等操作,开箱即用。
目前版本暂时不支持外键关联关系。
# -------------------------------
Django database introspection tool, through the data table name can dynamically create a Django models ready-to-use objects.
Just need a table name, you can immediately get a usable Django model, and immediately query, update and other operations, out of the box.
The current version does not support foreign key relationships.
# -------------------------------
```
In [4]: from django-db-introspection.introspection import get_my_models
In [5]: client_device_user = ModelFactory('monkey_king', 'client_device_user').models
class ClientDeviceUser(models.Model):
box_id = models.CharField(max_length=20)
device_id = models.CharField(max_length=50, blank=True, null=True)
user_id = models.CharField(max_length=37)
name4user = models.CharField(max_length=50, blank=True, null=True)
email = models.IntegerField(blank=True, null=True)
sms = models.IntegerField(blank=True, null=True)
voice = models.IntegerField(blank=True, null=True)
push = models.IntegerField(blank=True, null=True)
master = models.IntegerField(blank=True, null=True)
agent = models.IntegerField(blank=True, null=True)
class Meta:
db_table='client_device_user'
/usr/local/lib/python3.5/dist-packages/django/db/models/base.py:325: RuntimeWarning: Model 'monkey_king.clientdeviceuser' wasalready registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
0.019804232000751654
In [6]: client_device_user.objects.first().box_id
Out[6]: '01J01ELQ15'
In [7]:
```
Django 数据库内省工具, 通过数据表名就可以动态创建一个即时可用的Django models对象。
仅仅需要一个表名,你就可以立即得到一个可用的Django 模型,并立即进行查询,更新等操作,开箱即用。
目前版本暂时不支持外键关联关系。
# -------------------------------
Django database introspection tool, through the data table name can dynamically create a Django models ready-to-use objects.
Just need a table name, you can immediately get a usable Django model, and immediately query, update and other operations, out of the box.
The current version does not support foreign key relationships.
# -------------------------------
```
In [4]: from django-db-introspection.introspection import get_my_models
In [5]: client_device_user = ModelFactory('monkey_king', 'client_device_user').models
class ClientDeviceUser(models.Model):
box_id = models.CharField(max_length=20)
device_id = models.CharField(max_length=50, blank=True, null=True)
user_id = models.CharField(max_length=37)
name4user = models.CharField(max_length=50, blank=True, null=True)
email = models.IntegerField(blank=True, null=True)
sms = models.IntegerField(blank=True, null=True)
voice = models.IntegerField(blank=True, null=True)
push = models.IntegerField(blank=True, null=True)
master = models.IntegerField(blank=True, null=True)
agent = models.IntegerField(blank=True, null=True)
class Meta:
db_table='client_device_user'
/usr/local/lib/python3.5/dist-packages/django/db/models/base.py:325: RuntimeWarning: Model 'monkey_king.clientdeviceuser' wasalready registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
0.019804232000751654
In [6]: client_device_user.objects.first().box_id
Out[6]: '01J01ELQ15'
In [7]:
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-db-introspection-0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bea57f90b955981c7643b1e1bdab87d4b11db794c7f6db809b5fa6114e87025f |
|
MD5 | e311c30ef70def42caf3fa4dabd5f5ea |
|
BLAKE2b-256 | fa0f2d842c75fd5bcc1b2a41ace15c68c5bef8fe377a0ee55dd529bd2088f5cb |
Close
Hashes for django_db_introspection-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4148a404968e9461d1485bf02a866b9a07652be1ec3aa68c44304f96508a918 |
|
MD5 | 5a31be2888f1d6455746e05b507e79ee |
|
BLAKE2b-256 | affd7a0f1b555e57e2acdfd39a3eb8320f7935d8bb787c3dcbeb99f79c05c065 |