Giter Club home page Giter Club logo

Comments (11)

gangly avatar gangly commented on May 19, 2024

在datafaker/dbs/basedb.py文件parse_schema_from_rows函数部分
if cmd == 'enum':
if len(rets) == 0:
raise EnumMustNotEmptyError

            # 如果enum类型只有一个值,则产生固定值
            # 如果enum类型只有一个值,且以file://开头,则读取文件
            if len(rets) == 1 and rets[0].startswith(ENUM_FILE):
                rets = read_file_lines(rets[0][len(ENUM_FILE):])

            if ctype in INT_TYPES:
                args = [int(ret) for ret in rets]
            elif ctype in FLOAT_TYPES:
                args = [float(ret) for ret in rets]
            else:
                args = rets

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

好的,非常感谢~我去试试能不能改改

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

您好,现在大部分逻辑理清了,就还有一个问题,如果我遍历列表,用return只能返回第一个值,用yield的话,就会生成一堆对象的地址。。
image
image

from datafaker.

gangly avatar gangly commented on May 19, 2024

感谢提供代码和修改意见,我近期会尽快合并代码实现顺序enum功能

from datafaker.

gangly avatar gangly commented on May 19, 2024

您好,现在大部分逻辑理清了,就还有一个问题,如果我遍历列表,用return只能返回第一个值,用yield的话,就会生成一堆对象的地址。。
image
image

这里不能用yield,需要用一个变量标记数组index递增,实现循环顺序取值。
比如数组是10个值,需要产生30个值,需要循环顺序遍历3次

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

我在init函数里定义了一个index初始化为0,然后在函数内部累加,但好像还不是按顺序插入的。。能大概讲解一下实现逻辑嘛
image

from datafaker.

gangly avatar gangly commented on May 19, 2024

已新增order_enum类型

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

非常感谢,不过我刚刚更完最新版本发现,如果2个字段都用顺序枚举,就会出现下面这种问题。。

image

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

而且麻烦顺序枚举能够支持从文件读取,目前order_enum无法识别file://开头的txt文件。如下图
image

from datafaker.

gangly avatar gangly commented on May 19, 2024

而且麻烦顺序枚举能够支持从文件读取,目前order_enum无法识别file://开头的txt文件。如下图
image

已经支持了,请更新到最新版本0.6.2

from datafaker.

a3733092 avatar a3733092 commented on May 19, 2024

已更新到0.6.2,已经支持,非常感谢!

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.