Comments (10)
you should be able to use the date_between provider in the way you mentioned, using the fake_args feature.
column_name:
type: fake_update
fake_type: date_between
fake_args:
start_date: "-50y"
end_date: "-18y"
You can read more about how passing args to generators works in the docs.
Let me know how you get on āØ
from pynonymizer.
You prolly can do something with a type literal and then use some sql
to generate it @amz4u2nv
from pynonymizer.
Thanks,
Is there any example, of using this
date_between_dates
from pynonymizer.
If you're doing >18 age, can you filter via based on the table? Like for example
mysql> select * from person;
+-----+----------+--------+------+
| number | name | gender | age |
+-----+----------+--------+------+
| 114 | kev | m | 18 |
| 115 | brian | m | 18 |
+-----+----------+--------+------+
select * from table_name where timestampdiff(year,age,curdate()) > 50
Or something like this
from pynonymizer.
My bad at not explaining it, Iām trying to generate a fake dob but need the dob to be set so that they are all over 18
from pynonymizer.
Thanks @rwnx, that did the trick
I was trying to use date_between_dates -
like below
date_of_birth:
type: fake_update
fake_type: date_between_dates
fake_args:
start_date: '1975-01-01'
end_date: '2001-01-01'
but got this error -
Unsupported Fake type: date_between_dates: dict_keys(['start_date', 'end_date'])
Not sure why this didnt work, do you know where the best place to see if my keys are correct and if the date inputs are in the correct format.
Thanks
from pynonymizer.
So a Unsupported Fake type is thrown when the generator, date_between_dates
can't be found in the faker object being used.
can you give me some more info, e.g. your pynonymizer version, the version of faker you have, the locale being used in the strategy/config?
from pynonymizer.
the version of pynonymizer is 1.21.3
faker 11.3.0
I didn't choose explicity a locale but tried it with and without
pynonymizer -u root -p root -i test1.sql -s table_strategy.yml -o testdumpanon.sql
tables:
applicant_applicant:
columns:
firstName: first_name
lastName: last_name
dateOfBirth:
type: fake_update
fake_type: date_between_dates
fake_args:
start_date: '1975-01-01'
end_date: '2003-01-01'
Also taking out the fake_args in the above example, doesn't show any error, but it requires the params to make it work correctly.
from pynonymizer.
Ahh, I think i have something for you. date_between_dates and date_between take different kwarg names š (date_start vs start_date)
date_between_dates
strings will work either, unless the yaml parser supports datetime parsing natively. Can i ask why you want to use date_between_dates / Did you try using date_between
? It seems like they'd have the same effect (pynonymizer will be using a string value in the insert/update statement anyway).
from pynonymizer.
yup that did the trick...my bad, should have spotted that.
date_between work absolutely fine, it was just when i trying to figure out how to resolve it, I came across date_between_dates, and was just wandering why it didn't work for me.
Thanks for all your help, much appreciated.
from pynonymizer.
Related Issues (20)
- parallelise the anonymisation step HOT 4
- TypeError: 'NoneType' object is not iterable HOT 5
- Request support for SQLEXPRESS for db-type = mssql HOT 3
- Improve ODBC interaction: Accept a connection string HOT 2
- Improve deployability: Dockerize pynonymizer HOT 2
- Not everything is dumpt HOT 4
- Error on executing command caused by 'ANSI_WARNINGS' for mssql database HOT 8
- Restore stdin / stdout integration test HOT 1
- fix: warning in CI HOT 1
- Error with parameter --skip-steps HOT 2
- handle busy connection when threading HOT 1
- Missing inputs message should not return exit code "0" HOT 2
- Should INPUTS be mandatory when RESTORE_DB is skipped? HOT 2
- PYNONYMIZER_STRATEGY dropped without deprecation HOT 5
- --help output has duplicate --mysql-cmd-opts HOT 2
- Mechanisms to reduce load on server? HOT 5
- Updated docker images? HOT 3
- --verbose flag doesnt work
- Connectionstring fix HOT 2
- pynoymizer doesn't seem to trap mysqldump failing? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pynonymizer.