Giter Site home page Giter Site logo

模拟多表关联数据 通过制定某些字段为枚举类型(从指定的数据列表里面随机选择),这样在数据量多的情况下能保证多表Join能关联上,查询到数据 about datafaker HOT 7 OPEN

gangly avatar gangly commented on May 10, 2024
模拟多表关联数据 通过制定某些字段为枚举类型(从指定的数据列表里面随机选择),这样在数据量多的情况下能保证多表Join能关联上,查询到数据

from datafaker.

Comments (7)

gangly avatar gangly commented on May 10, 2024

就是两个表需要关联的字段都用同一份枚举类型。那么生成的数据在两个表中会有相同的,就能关联上

from datafaker.

liuzhengxing avatar liuzhengxing commented on May 10, 2024

举个例子,A表有两个字段证券代码,证券名称,分别要从B表中取,是不是把B表中字段制定为枚举类型,然后随机取呢?

from datafaker.

gangly avatar gangly commented on May 10, 2024

举个例子,A表有两个字段证券代码,证券名称,分别要从B表中取,是不是把B表中字段制定为枚举类型,然后随机取呢?

目前只能实现:
把b表中数据导出为文件,在A表指定枚举类型和文件路径,A表字段会随机从文件取值

from datafaker.

alex-yul avatar alex-yul commented on May 10, 2024

这个很多场景是一对一关系。。。是否可以顺序取值,生成条数和主表一致,比较关注

from datafaker.

gangly avatar gangly commented on May 10, 2024

这个很多场景是一对一关系。。。是否可以顺序取值,生成条数和主表一致,比较关注

增加了order_enum类型,用于解决这个问题

from datafaker.

weiweijiayou avatar weiweijiayou commented on May 10, 2024

作者你好,关于order_enum类型实在没看懂,能不能举个小例子,以及在编写meta.txt文件时,应该怎么使用?

from datafaker.

gangly avatar gangly commented on May 10, 2024

作者你好,关于order_enum类型实在没看懂,能不能举个小例子,以及在编写meta.txt文件时,应该怎么使用?

是这样的场景,比如表里面有两个字段需要一一对应,一个是城市编码,一个城市名,
city_code|||varchar|||[:order_enum(file://code.txt)]
city_name|||varchar|||[:order_enum(file://names.txt)]

其中code.txt为城市编码,names.txt为城市名,两个文件行数相同,每行内容一一对应
用order_enum按顺序取值,能确保两个字段取得城市编码和城市名一一对应

from datafaker.

Related Issues (20)

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.