投稿時間:2023-02-19 18:08:31 RSSフィード2023-02-19 18:00 分まとめ(11件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita 【Ansible】Amazon EC2でansible-navigatorを使いたい~第1章:実行環境イメージの作成~ https://qiita.com/masa2223/items/5f9c641836115c3ecd1d amazon 2023-02-19 17:26:15
python Pythonタグが付けられた新着投稿 - Qiita `pandas.DataFrame.pivot_table`での「If any error is raised, this will raise an exception in a future version of pandas.」という警告メッセージへの対応方法 https://qiita.com/yuji38kwmt/items/7d97b9ffa0784ce3c4bb pandasDataFramepivottableでの「Ifanyerrorisraisedthiswillraiseanexceptioninafutureversionofpandas」という警告メッセージへの対応方法環境PythonpandasやりたいことpandasDataFramepivottableを使って、以下のような集計を行いたいです。 2023-02-19 17:18:36
js JavaScriptタグが付けられた新着投稿 - Qiita 配列、連想配列、Mapオブジェクト まとめ https://qiita.com/sforest1975/items/c53e161ce66a951e7b4e 連想配列 2023-02-19 17:57:48
js JavaScriptタグが付けられた新着投稿 - Qiita Github Copilot で四則演算パーサーを作ってみる https://qiita.com/7shi/items/bea04b48a66c22b83450 githubcopilot 2023-02-19 17:30:42
AWS AWSタグが付けられた新着投稿 - Qiita 【Ansible】Amazon EC2でansible-navigatorを使いたい~第1章:実行環境イメージの作成~ https://qiita.com/masa2223/items/5f9c641836115c3ecd1d amazon 2023-02-19 17:26:15
Docker dockerタグが付けられた新着投稿 - Qiita microk8sとkubeflowで機械学習開発基盤を構築(MLOps) https://qiita.com/oriki101/items/11b9305e433d48bc8ac8 kubeflow 2023-02-19 17:44:14
海外TECH DEV Community Soft delete: Implementation issues in Prisma and solution in ZenStack https://dev.to/zenstack/soft-delete-implementation-issues-in-prisma-and-solution-in-zenstack-23fl Soft delete Implementation issues in Prisma and solution in ZenStackSoft delete is a common requirement for SaaS products But the current solution in Prisma has certain issues Let s see how ZenStack solves it What is soft deleteNormally when you run a DELETE statement in a database the data is gone Instead of permanently deleting the record Soft delete updates a column in the record typically named deleted at or is deleted to indicate that the record has been marked for deletion Pros of soft deleteSoft delete has been almost the MUST for me when building commercial SaaS products for the last years I will show you why based on my own experience RecoverabilityI bet you have ever regret of deleting something and trying to recover it back because it s common for humans to make a mistake That s why lots of applications including operating systems also adopt Soft delete by introducing Recycle Trash bins As a service provider even providing the Archive functionality and showing users countless warnings and troubles before they delete the record from your database like below Tragedy still happens You could comfort yourself by saying I have done all I can do But when a customer comes to you almost crying to ask for help how can you bear to give him a refusal According to Muphy s law Anything that can go wrong will go wrong Therefore the most effective approach is to avoid granting the user the opportunity to delete data from the database entirelyーto do soft delete Data IntegrityYou can see this one has been brought up a lot I think it is from the database point of view to main referential integrity From the practical point of view the benefit is still for recovery For example Let s say you have two tables User and Post in your database If a user is accidentally deleted all the posts belonging to this user are either deleted too for Cascade or become orphaned for SetNull Even if you could find a way to restore the user the posts are gone AnalyticsWhether you are a product led or marketing led growth model data analytics of your product is the basic thing for online business nowadays Let s say you are building a Notion like product If you want to know how many pages the user actually created last month you can easily write the SQL like this SELECT COUNT FROM pagesWHERE created at gt DATE TRUNC month CURRENT DATE INTERVAL MONTH AND created at lt DATE TRUNC month CURRENT DATE Wait a minute does it include the page that the user created and then deleted last month Some people suggest that this kind of requirement should be done by logging The problem is like you never know what kind of analytics requirement you will meet What if the next day the product manager wants to see how many posts containing a table or video were created last month You might end up logging everything that appears in the database to meet the requirements And even you could do so the analytics process becomes more complicated as you have to collect and merge data from both your database and the logging system DiagnosisThe non consistent reproduced bug is always the hardest one to deal with There are a couple of times users sent a video or screenshot saying something weird happened When you want to investigate more you see that weird data has been deleted by the user It s understandable as no one wants to leave some defect there Luckily as we were using soft delete we could still find the data to try to reconstruct the crime scene to find the bug in our code finally ConsThe most important reason why people don t use Soft delete is the implementation challenge Besides the query update there are other issues that need to be considered like index unique constraint etc which is definitely not an easy task and will definitely increase the complexity of your system Soft Delete in PrismaThe good thing is that fewer people are working directly on the SQL anymore and most ORMs have the solution for it You can see how Prisma uses middleware to perform a soft delete below Middleware sample soft delete Reference Although the page is long the solution is quite straightforward It mainly does two things For delete operation change it to update operationif params action delete Delete queries Change action to an update params action update params args data deleted true if params action deleteMany Delete many queries params action updateMany if params args data undefined params args data deleted true else params args data deleted true For find operation add a filter to filter out soft deleted records if params action findUnique params action findFirst Change to findFirst you cannot filter by anything except ID unique with findUnique params action findFirst Add deleted filter ID filter maintained params args where deleted false if params action findMany Find many queries if params args where if params args where deleted undefined Exclude deleted records if they have not been explicitly requested params args where deleted false else params args where deleted false However there are some issues with this approach which I think is also the reason why the issue in GitHub is still open Soft deletes e g deleted at matthewmueller posted on Jun It could be nice to add this kind of feature to core so you get filtered views without cluttering up your application queriesOpen questions Would it be slow to add this filter to all queries Can we do it only when we need it Would this be better handled in Photon View on GitHub TLDR the biggest problem is that it would fall short when the relation field is involved in the filter There are two major cases Can t handle includeconst user await prisma user findMany where id include posts true The deleted posts would also be included in the result Can t handle relation filterconst us await prisma user findMany where posts some title contains Prisma If only any title of deleted posts of the user contains “Prisma that user would also be returned You might think it doesn t seem to be hard to fix it for both by adding the deleted filter It might be for the above example but how about this one const user await prisma user findMany where posts every title contains Prisma Why not think about how to add the filter before reading down You have to change it to the below query const user await prisma user findMany where posts none AND deleted true title not contains Prisma As Prisma provides a quite flexible filter with several operators like AND OR NOT some every none etc it would also take quite an effort to consider each individually I guess that s probably why the issue has not been fixed yet Soft delete in ZenStackZenStack is the toolkit that supercharges Prisma with a powerful access control layer and unleashes its full potential for full stack development As an enhancement of Prisma after supporting Custom attributes issues below How to add custom attributes in Prisma JS for ZenStack・Feb ・ min read webdev javascript prisma productivity This one looks like a good next for us For the delete operation I think you can still use the middleware approach above or the new client extension to implement it That should not be a problem For the most complicated query logic as ZenStack supports access control policy it is natural to support it Because technically filtering out soft deleted records is also a kind of access policy So for any model if you want to do the soft delete you just need to add the below access policy model Post deleted Boolean default false omit deny read deleted Then when using ZenStack to do a query it will automatically exclude soft deleted records If you want to also include the soft deleted records you can simply use the original Prisma client instead To be honest we were not aware that ZenStack had problem of supporting it either until a customer reported an issue on our Discord platform Upon fixing the issue we gained insight into its complexity and why Prisma had not supported it given the existing code and usage Fortunately as ZenStack has less legacy we were able to resolve the issue quickly Conversely we had fewer real world use cases So if you guys meet any case that we missed we would appreciate it if you could create an issue in Github or directly throw it to our Discord Let s make ZenStack better together 2023-02-19 08:25:29
海外TECH DEV Community Using python dictionary in data engineering. https://dev.to/ndurumo254/using-python-dictionary-in-data-engineering-3oec Using python dictionary in data engineering Python dictionaries are a powerful data structure that can be useful in many data engineering applications In this blog we ll explore some of the ways that you can use Python dictionaries in data engineering including how to create and manipulate dictionaries and how to use them in various data processing tasks What is a Python Dictionary A Python dictionary is a collection of key value pairs that allows you to store and retrieve data using a key Dictionaries are one of the core data structures in Python and are commonly used in a variety of applications including data engineering Here s an example of a simple dictionary in Python In this dictionary the keys are key key and key and the values are value value and value respectively Creating and Accessing DictionariesTo create a dictionary in Python you can use the curly braces and separate the key value pairs with colons Here s an example You can also create a dictionary using the dict function which takes a sequence of key value pairs as an argument For example Once you have created a dictionary you can access its values by using the keys For example to access the value associated with the name key in the dictionary above you can use the following code This will output Alice Manipulating DictionariesDictionaries are mutable which means that you can add delete and modify key value pairs in the dictionary Here are some of the ways that you can manipulate dictionaries in Python Adding Key Value PairsTo add a new key value pair to a dictionary you can simply assign a value to a new keyThis will add a new key email with the value alice example com to the dictionary Modifying ValuesTo modify the value associated with a key in a dictionary you can simply reassign the value This will change the value associated with the age key from to Deleting Key Value PairsTo delete a key value pair from a dictionary you can use the del statement This will remove the age key and its associated value from the dictionary Using Dictionaries in Data EngineeringDictionaries can be used in a variety of data engineering tasks including data cleaning data transformation and data aggregation Here are some examples of how dictionaries can be used in data engineering Data CleaningSuppose you have a dataset that contains customer information and you want to clean up the data by standardizing the state names You could create a dictionary that maps the abbreviated state names to the full state names and then use that dictionary to replace the abbreviated state names in the datasethappy coding 2023-02-19 08:14:20
海外TECH CodeProject Latest Articles Event Sourcing on Azure Functions https://www.codeproject.com/Articles/5205463/Event-Sourcing-on-Azure-Functions functions 2023-02-19 08:40:00
ニュース BBC News - Home Leigh Wood v Mauricio Lara: Briton loses world title with stoppage defeat in thrilling fight https://www.bbc.co.uk/sport/boxing/64688427?at_medium=RSS&at_campaign=KARANGA Leigh Wood v Mauricio Lara Briton loses world title with stoppage defeat in thrilling fightLeigh Wood s reign as WBA featherweight champion is over after the Briton loses to hard hitting Mauricio Lara in Nottingham 2023-02-19 08:12:11
ニュース BBC News - Home Genesis Invitational: Jon Rahm leads as Tiger Woods improves https://www.bbc.co.uk/sport/golf/64694945?at_medium=RSS&at_campaign=KARANGA Genesis Invitational Jon Rahm leads as Tiger Woods improvesSpain s Jon Rahm moves closer to regaining the world number one spot as he opens up a three shot lead at the Genesis Invitational in California 2023-02-19 08:36:07

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)